table move rows
This function moves a specified number of rows 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
2 - 5
No. | Type | Description |
---|---|---|
1. input |
string | Name of existing source table |
2. input |
string | Name of existing destination table |
Opt. 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) |
Opt. 4 input |
numeral | Source starting row number Row movement begins at the specified row number. Negative indexing is supported here.
|
Opt. 5 input |
numeral | Source ending row number Row movement ends at specified row number, including that row. No rows will be transferred if it is smaller than the starting row number. Negative indexing is supported here where -1 refers to the last existing row. Default value: -1 (till end of table, including last row) |
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 rows ( t1, t2 );
echo( new line, "Move all names from t1 to end of t2");
echo( "t1: ", [t1:Name,..] );
echo( "t2: ", [t2:Names,..] );
table move rows( t2, t1, -1, 9 );
echo( new line, "Move the same names back to t1");
echo( "t1: ", [t1:Name,..] );
echo( "t2: ", [t2:Names,..] );
table move rows( t2, t1, 4, 3, 5 );
echo( new line, "Move 3 names (Tim, Udo, Victor) in t2 to t1 before Daniela");
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: {}
t2: {'Richard','Sam','Tim','Udo','Victor','Xavier','Yoel','Zoe','Amy','Bea','Colin','Daniela','Emily','Fabian'}
Move the same names back to t1
t1: {'Amy','Bea','Colin','Daniela','Emily','Fabian'}
t2: {'Richard','Sam','Tim','Udo','Victor','Xavier','Yoel','Zoe'}
Move 3 names (Tim, Udo, Victor) in t2 to t1 before Daniela
t1: {'Amy','Bea','Colin','Tim','Udo','Victor','Daniela','Emily','Fabian'}
t2: {'Richard','Sam','Xavier','Yoel','Zoe'}