table delete blank/empty/unnamed columns

Prev Next

Function Names

table delete blank columns, table delete all blank columns, table delete empty columns, table delete all empty columns, table delete unnamed columns, table delete all unnamed columns

Description

table delete ... blank columns deletes all columns where the selected columns are blank in all rows, including the header row.
table delete ... empty columns deletes all columns where the selected columns are blank in all rows, excluding the header row.
table delete ... unnamed columns deletes all columns with blank contents in the header row (no headers specified).
The function names not containing ... all ... will only consider the columns below the existing header row.
The function names contaiing ... all ... will cover the full table widht, i.e. also consider columns located beyond the header row.

Call as: procedure

Restrictions

Indirect parameter passing is enabled

Parameter count

Min. 1

Parameters

No.TypeDescription
1., ...
input
string Names of existing tables

Exceptions

Table not found

Examples

  table initialize ( table, { { First Name, "",    Last Name, "",            Phone No, "   ", Age                  },
                  { Jane,       "E.",  Archer,    "1. Main St.", "",       "   ", 28, "             ", Plays softball } } );

  echo("Original table: ", table max width(table), " columns. __________________ ");
  table list( table );

  table copy table (table, t1 );
  table delete blank columns(t1);
  echo("Blank columns deleted: ", table max width(t1), " columns. __________________ ");
  table list( t1 );

  table copy table (table, t1 );
  table delete all blank columns(t1);
  echo("All blank columns deleted: ", table max width(t1), " columns. __________________ ");
  table list( t1 );

  table copy table (table, t1 );
  table delete empty columns(t1);
  echo("Empty columns deleted: ", table max width(t1), " columns. __________________ ");
  table list( t1 );

  table copy table (table, t1 );
  table delete all empty columns(t1);
  echo("All empty columns deleted: ", table max width(t1), " columns. __________________ ");
  table list( t1 );

  table copy table (table, t1 );
  table delete unnamed columns(t1);
  echo("Unnamed deleted: ", table max width(t1), " columns. __________________ ");
  table list( t1 );

  table copy table (table, t1 );
  table delete all unnamed columns(t1);
  echo("All unnamed deleted: ", table max width(t1), " columns. __________________ ");
  table list( t1 );

Output

Original table: 9 columns. __________________
    0 : First Name |    | Last Name |             | Phone No |     | Age |               |               
    1 : Jane       | E. | Archer    | 1. Main St. |          |     | 28  |               | Plays softball

Blank columns deleted: 8 columns. __________________
    0 : First Name |    | Last Name |             | Phone No | Age |               |               
    1 : Jane       | E. | Archer    | 1. Main St. |          | 28  |               | Plays softball

All blank columns deleted: 7 columns. __________________
    0 : First Name |    | Last Name |             | Phone No | Age |               
    1 : Jane       | E. | Archer    | 1. Main St. |          | 28  | Plays softball

Empty columns deleted: 7 columns. __________________
    0 : First Name |    | Last Name |             | Age |               |               
    1 : Jane       | E. | Archer    | 1. Main St. | 28  |               | Plays softball

All empty columns deleted: 6 columns. __________________
    0 : First Name |    | Last Name |             | Age |               
    1 : Jane       | E. | Archer    | 1. Main St. | 28  | Plays softball

Unnamed deleted: 6 columns. __________________
    0 : First Name | Last Name | Phone No | Age |               |               
    1 : Jane       | Archer    |          | 28  |               | Plays softball

All unnamed deleted: 4 columns. __________________
    0 : First Name | Last Name | Phone No | Age
    1 : Jane       | Archer    |          | 28

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

See also

table delete columns