table check row

Prev Next

Function Names

table check row

Description

This function checks if this row is blank. Some value-added critieria can be applied in the parameters.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

2 - 4

Parameters

No.TypeDescription
1.
input
string Name of existing table

2.
input
numeral Row number

The specified row will be checked.

Opt. 3.
input
string Blank criterion

One of following:

entirely empty row True if row contain 0 columns
empty row True if row contains 0 or 1 empty column
empty fields True if row contains any number of empty fields (nothing inside, not even a white space)
blank fields True if row contains any number of fields which are either empty or containing white spaces (no visible characters)
not blank begin True if not blank, but row above meets blank fields criteria, but not the rows below
not blank middle True if not blank, rows above and below are also not blank, too
not blank end True if not blank, but row below meets blank fields criteria, but not the rows above
not blank lone True if row is not blank, but row above and below meet blank fields criteria.
not blank True if row is not blank (contains visible characters), regardless if at top, middle or end of block of non-blank rows

Note: The 'not blank...' criteria listed at the bottom use the 'blank fields' criteria to distinguish whether the other rows are deemed blank or not.

Default value: blank fields
Opt 4
input
table columns Columns to check

Specify the columns which shall be checked if they are blank and ignore the contents in the remaining columns.

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

Default value: all columns

Return value

TypeDescription
numeral Number of rows deleted

Examples

  table initialize( t,
      { {  Last Name,    First Name,    Favorite Sports },
        {  Adams,        Andy,          American Football },
        {  "  ",         "",            Baseball },
        { },
        {  "" },
        {  "",           "" },
        {  Mayer,        Mick,          Tennis },
        {  " " },
        {  Gerber,       Greg,          Canooing },
        {  Unger,        Uta,           Rafting },
        {  Tanner,       Tina,          Wrestling } } );


  table initialize( result, {Criteria, entirely empty row, empty row, empty fields, blank fields,
                             not blank begin, not blank middle, not blank end, not blank lone, not blank } );

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

  table process ( result,
      table process( t, [result:row(),0     ] = row();
                            [result:row(),row(1)] = table check row( t, row(), [^Criteria] ) ) );

  echo("The columns in the table below relate to the row numbers of the table checked.");
  table list ( result );

Output

Original table:
    0 : Last Name | First Name | Favorite Sports  
    1 : Adams     | Andy       | American Football
    2 :           |            | Baseball         
    3 :           |            |                  
    4 :           |            |                  
    5 :           |            |                  
    6 : Mayer     | Mick       | Tennis           
    7 :           |            |                  
    8 : Gerber    | Greg       | Canooing         
    9 : Unger     | Uta        | Rafting          
   10 : Tanner    | Tina       | Wrestling        

The columns in the table below relate to the row numbers of the table checked.
    0 : Criteria           | 1     | 2     | 3     | 4     | 5     | 6     | 7     | 8     | 9     | 10   
    1 : entirely empty row | false | false | true  | false | false | false | false | false | false | false
    2 : empty row          | false | false | true  | true  | false | false | false | false | false | false
    3 : empty fields       | false | false | true  | true  | true  | false | false | false | false | false
    4 : blank fields       | false | false | true  | true  | true  | false | true  | false | false | false
    5 : not blank begin    | false | false | false | false | false | false | false | true  | false | false
    6 : not blank middle   | true  | false | false | false | false | false | false | false | true  | false
    7 : not blank end      | false | true  | false | false | false | false | false | false | false | true
    8 : not blank lone     | false | false | false | false | false | true  | false | false | false | false
    9 : not blank          | true  | true  | false | false | false | true  | false | true  | true  | true

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

See also

table delete blank rows