table copy table columns, table copy table columns selected rows
This function makes a copy of the table with all selected columns.
The function table copy table columns selected rows copies only the selected rows instead of all rows.
If the new table is already existing, then it will be initialized.
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
3-4
No. | Type | Description |
---|---|---|
1. input |
string | Name of existing table |
2. input |
string | Name of new table |
3. input |
table columns | Header names and/or column numbers See table columns as function parameters for general ruling for this parameter.
|
Opt. 4. code |
expression :string |
Expression to select rows to copy Applicable for table copy table columns selected rows only: The selected rows will be copied into the new table. |
table initialize( t, {{ Name, Age, Hobby },
{ Ann, 45, Skiing }, { Dan, 35, Skating }, { Eva, 40, Bee keeping }, { Nic, 10, Reading } } );
echo("Original table:");
table list( t );
echo("Copy Hobby and Name:");
table copy table columns ( t, u, {Hobby, Name} );
table list( u );
echo("Copy Name and Age of young people:");
table copy table columns selected rows ( t, v, {Name, Age}, [Age]<40 );
table list( v );
Original table:
0 : Name | Age | Hobby
1 : Ann | 45 | Skiing
2 : Dan | 35 | Skating
3 : Eva | 40 | Bee keeping
4 : Nic | 10 | Reading
Copy Hobby and Name:
0 : Hobby | Name
1 : Skiing | Ann
2 : Skating | Dan
3 : Bee keeping | Eva
4 : Reading | Nic
Copy Name and Age of young people:
0 : Name | Age
1 : Dan | 35
2 : Nic | 10