table move selected rows
This function moves selected rows (using an expression) from one table to another table. With high performance in focus, this function moves
the rows as they are, i.e. the individual data stay in their column locations where they are and they will not be realigned in order
to match with the header names.
Please consider useing table merge() or transactions if you want to move data with alignments to their headers.
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
4
No. | Type | Description |
---|---|---|
1. input |
string | Name of existing source table |
2. input |
string | Name of existing destination table |
3 input |
numeral | Destination row number The contents from the source table will be moved to the destination table, beginning with this specified row number in the destination table. All other rows in the destination table will move down. Negative indexing is supported here, whereas -1 is exceptionally referencing to the next row below the last row.
If the 3rd parameter is not specified, then the rows will be added to the end of the table. Since the remaining parameters are not specified too, B4P assumes to move the entire table (except header row) to the end of the destination table. Default value: -1 (below the last table row) |
4. code |
expression :string |
Expression to select rows Specify the conditions or rules to select the rows in the source table. See expressions to select rows. |
Type | Description |
---|---|
numeral | Number of rows moved Number of rows moved. -1 is returned if table is empty. |
Table not found
table initialize( t1, { Name, Amy, Bea, Colin, Daniela, Emily, Fabian } );
table initialize( t2, { Names, Richard, Sam, Tim, Udo, Victor, Xavier, Yoel, Zoe } );
echo( new line, "Original tables");
echo( "t1: ", [t1:Name,..] );
echo( "t2: ", [t2:Names,..] );
table move selected rows ( t1, t2, -1, [Name]{}=5 ); // Move Colin and Emily (5 letters)
echo( new line, "Move all names from t1 to end of t2");
echo( "t1: ", [t1:Name,..] );
echo( "t2: ", [t2:Names,..] );
Original tables
t1: {'Amy','Bea','Colin','Daniela','Emily','Fabian'}
t2: {'Richard','Sam','Tim','Udo','Victor','Xavier','Yoel','Zoe'}
Move all names from t1 to end of t2
t1: {'Amy','Bea','Daniela','Fabian'}
t2: {'Richard','Sam','Tim','Udo','Victor','Xavier','Yoel','Zoe','Colin','Emily'}