table delete selected rows
This function deletes all rows where the expression to select rows applies. The header row will be protected from getting deleted.
Indirect parameter passing is disabled
This function provides a table context for partial table specifications with table name and row number for selected function parameters
2 - 4
No. | Type | Description |
---|---|---|
1. input |
string | Name of existing table |
2. code |
expression :string |
Expression to select rows Specify the conditions or rules to select the rows. See expressions to select rows. |
Opt. 3. input |
numeral | Number of rows to delete
|
Opt. 4. input |
numeral | Row offset value
|
Type | Description |
---|---|
numeral | Number of rows deleted Number of rows deleted. -1 is returned if table is empty. |
table initialize ( table 1,
{ { Animal, leg count }, { Worm, 0}, { Bird, 2 }, { Dog, 4 }, { Fly, 6 }, { Tick, 8 } } );
table copy table( table 1, t1 );
echo("Delete 2 rows: Bird and Tick.");
table delete selected rows( t1, ([Animal]='*i*') ); // Bird, Tick
table list( t1 ); // Only Dog and Fly are left
echo("Dog will also be deleted:");
table copy table( table 1, t1 );
table delete selected rows( t1, ([Animal]='*i*'), 2 ); // Bird, Tick, Dog deleted
table list( t1 ); // Only Dog and Fly are left
echo("Delete animal above Dog and Worm:");
table copy table( table 1, t1 );
table delete selected rows( t1, ([Animal]='*o*'), 1, -2 ); // Rows above Worm, Dog
table list( t1 ); // Only Dog and Fly are left
Delete 2 rows: Bird and Tick.
0 : Animal | leg count
1 : Worm | 0
2 : Dog | 4
3 : Fly | 6
Dog will also be deleted:
0 : Animal | leg count
1 : Worm | 0
2 : Fly | 6
Delete animal above Dog and Worm:
0 : Animal | leg count
1 : Worm | 0
2 : Dog | 4
3 : Fly | 6
4 : Tick | 8