table delete remaining columns

Prev Next

Function Names

table delete remaining columns

Description

This function deletes all remaining columns to the right, including the specified column.

Call as: procedure or function

Restrictions

Indirect parameter passing is disabled

Parameter count

2

Parameters

No.TypeDescription
1.
input
string Name of existing table

2
input
table columns Existing column

See table columns as function parameters for general ruling for this parameter.
Specific rules apply for this function:

  • Only one header name or column numbers may be specified

Hint: Use shifted table column specifications like '>Last Name' to delete remaining columns without the one specified.

Return value

TypeDescription
numeral Number of columns deleted

Exceptions

Table not found
Header name not found

Examples

  echo("Delete 3 column pairs");
  table initialize ( table, { { 'Col A' .. 'Col K' }, { 'Val A' .. 'Val K' } } );

  echo("Delete column H till end");
  count[] = table delete remaining columns(  table, Col H  );
  echo("Number of columns deleted: ", count[] );
  table list( table );

  echo("Delete column E till end");
  count[] = table delete remaining columns(  table, '>Col D'  );

  echo("Number of columns deleted: ", count[] );
  table list( table );

Output

Delete 3 column pairs
Delete column H till end
Number of columns deleted: 4
    0 : Col A | Col B | Col C | Col D | Col E | Col F | Col G
    1 : Val A | Val B | Val C | Val D | Val E | Val F | Val G

Delete column E till end
Number of columns deleted: 3
    0 : Col A | Col B | Col C | Col D
    1 : Val A | Val B | Val C | Val D

Try it yourself: Open LIB_Function_table_delete_remaining_columns.b4p in B4P_Examples.zip. Decompress before use.

See also

table delete columns