table delete cells in columns

Prev Next

Function Names

table delete cells in columns

Description

In a specified row, cells of specified columns will be deleted where the contents below will shift up.

Call as: procedure or function

Restrictions

Indirect parameter passing is disabled

Parameter count

3-4

Parameters

No.TypeDescription
1.
input
string Name of existing table

2
input
table columns Header names and/or column numbers

Only the cells in the specified columns will be deleted. See table columns as function parameters for general ruling for this parameter.
Specific rules apply for this function:

  • Any number of header names and column numbers may be specified

3.
input
numeral Row number

Starting row number where cells in specified columns (and below) will be deleted

Opt. 4.
input
string Count

Number of cells to delete (with contents below shifting up accordingly)
Negative indexing is supported, i.e. -1 removes all cells below, -2 removes all cells except the cell in the last row (which will move up accordingly), etc.

Default value: 1

Return value

TypeDescription
numeral Number of columns processed

Counts all columns selected where cells have been deleted.

Examples

       table initialize ( t,
         { { Nr,  A,  B,  C,  D,  E  },
                       {  1,  A1, B1, C1, D1, E1, F1, G1 },
                       {  2,  A2, B2, C2, D2, E2, F2, G2 },
                       {  3,  A3, B3, C3, D3, E3 },
                       {  4,  A4, B4, C4, D4, E4, F4, G4 },
                       {  5,  A5, B5, C5, D5, E5, F5, G5 } } );


       echo("Original table:");
       table list ( t );

       echo("2 cells removed columns A, B, C, D, E and column 7.");
       a[] = table delete cells in columns( t, {A..C,E,7}, 2, 2 );
       table list ( t );
       echo("Number of columns affected: ", a[]);

Output

Original table:
    0 : Nr | A  | B  | C  | D  | E  |    |   
    1 : 1  | A1 | B1 | C1 | D1 | E1 | F1 | G1
    2 : 2  | A2 | B2 | C2 | D2 | E2 | F2 | G2
    3 : 3  | A3 | B3 | C3 | D3 | E3 |    |   
    4 : 4  | A4 | B4 | C4 | D4 | E4 | F4 | G4
    5 : 5  | A5 | B5 | C5 | D5 | E5 | F5 | G5

2 cells removed columns A, B, C, D, E and column 7.
    0 : Nr | A  | B  | C  | D  | E  |    |   
    1 : 1  | A1 | B1 | C1 | D1 | E1 | F1 | G1
    2 : 2  | A4 | B4 | C4 | D2 | E4 | F2 | G4
    3 : 3  | A5 | B5 | C5 | D3 | E5 |    | G5
    4 : 4  |    |    |    | D4 |    | F4 |   
    5 : 5  |    |    |    | D5 |    | F5 |   

Number of columns affected: 5
Try it yourself: Open LIB_Function_table_delete_cells_in_columns.b4p in B4P_Examples.zip. Decompress before use.

See also

table delete cells selected rows