table keep columns, table keep existing columns
This function keeps and rearranges the columns specified according to the order provided in the 2nd function parameter. All remaining columns will be deleted.
Indirect parameter passing is disabled
2
No. | Type | Description |
---|---|---|
1. input |
string | Name of existing table |
2 input |
table columns | Existing columns See table columns as function parameters for general ruling for this parameter.
|
Table not found
Header name not found
table initialize ( table, { { First Name, "Middle Init.", Last Name, "Street", "Town" },
{ Jane, "E.", Archer, "1. Main St.", "Miami", "Comments" } } );
echo("Original table: ", table max width(table), " columns. __________________ ");
table list( table );
table copy table (table, t1 );
table keep columns(t1, { 2, First Name, -1 }); // Last Name, First Name, Town
echo("Names only: ", table max width(t1), " columns. __________________ ");
table list( t1 );
table copy table (table, t1 );
table keep existing columns(t1, { Phone, 2, First Name, -1 }); // Same outcome: "Phone" is ignored.
echo("Names only: ", table max width(t1), " columns. __________________ ");
table list( t1 );
Original table: 6 columns. __________________
0 : First Name | Middle Init. | Last Name | Street | Town |
1 : Jane | E. | Archer | 1. Main St. | Miami | Comments
Names only: 3 columns. __________________
0 : Last Name | First Name | Town
1 : Archer | Jane | Miami
Names only: 3 columns. __________________
0 : Last Name | First Name | Town
1 : Archer | Jane | Miami