table fill vertically ...

Prev Next

Function Names

table fill vertically, table fill vertically selected rows

Description

In various tables, contents are mentioned in only one row and the rows below are kept blank even though the same contents are assumed. This function will repeat the contents in accordingly.

Call as: procedure

Restrictions

Indirect parameter passing is disabled
This function provides a table context for partial table specifications with table name and row number for selected function parameters

Parameter count

2-5

Parameters

No.TypeDescription
1.
input
string Name of existing table

Opt. 2.
code
expression
:string
Expression to select rows

Applicable to table fill vertically selected rows only:
Specify the conditions or rules to select the rows. See expressions to select rows.
The table context for partial table specifications is available for referencing just the columns easily. Example: [Year]>=2022.
Attention: Comparison operators = and <> (instead of == and !=) may hijack the next function parameters for its own use as additional comparison operands, e.g. a[]=1,3,5. As long this comparison is not made in the last function parameter, then put parentheses around them, e.g. ... , (a[]=1,3,5), ....

2. / 3.
input
table columns Columns to repeat

In these columns, blank rows will be overwritten by the exsiting contents above (or below if specified in the last function parameter.
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

Opt. 3. / 4.
input
parameter set or string Strings representing repetition

If one string is provided, then it will be used to compare with all columns. If more strings are provided in a parameter set, then they will correspond with the columns specified. If the parameter set contains fewer elements than the number of columns provided, then the last element will apply for the remaining columns. Otherwise, if this parameter set is longer, then the excess values will be ignored. Soft quoted strings allow use of wildcard symbols in order to compare for different strings, e.g. 'see above*,' covers begins with 'see above' and equals to blanks (note the comma at the end).
Good examples: '"', '', "(see above)", "ditto", 'see above,look above',"*...*",'see*'
Note: If the 1st (or last) item is already deemed as blank (e.g. 'same'), then it will not be overwritten because no non-blank value is available yet.

Default value: '' (blank)
Opt. 4. / 5.
input
string Direction

Following values are supported: up and down for repeating contents in upward resp. downward direction.

Default value: down

Examples

  table initialize ( t, { {Name, Date, Tennis Scores},
       { Jim,   "2020-06-20", "6:5 6:2 6:3" },
       { "",    "same day"  , "7:6 6:4 5:6" },
       { "",    "2020-06-21", "6:2 5:6 4:6" },
       { Jane,  "same day",   "5:4 6:5 7:6" },
       { "",    "",           "3:6 7:6 6:5" } } );

  table copy table ( t, u );

  echo("Repeat blank entries");
  table fill vertically( t, { Name, Date }, { "", 'same day,' } );
  table list ( t );

  echo("Here: Ignore entries with blankn names. Jane played at the same date as Jim did.");
  table fill vertically selected rows ( u, [Name]!="", { Name, Date }, { "", 'same day,' } );
  table list ( u );

Output

Repeat blank entries
    0 : Name | Date       | Tennis Scores
    1 : Jim  | 2020-06-20 | 6:5 6:2 6:3  
    2 : Jim  | 2020-06-20 | 7:6 6:4 5:6  
    3 : Jim  | 2020-06-21 | 6:2 5:6 4:6  
    4 : Jane | 2020-06-21 | 5:4 6:5 7:6  
    5 : Jane | 2020-06-21 | 3:6 7:6 6:5  

Here: Ignore entries with blankn names. Jane played at the same date as Jim did.
    0 : Name | Date       | Tennis Scores
    1 : Jim  | 2020-06-20 | 6:5 6:2 6:3  
    2 :      | same day   | 7:6 6:4 5:6  
    3 :      | 2020-06-21 | 6:2 5:6 4:6  
    4 : Jane | 2020-06-20 | 5:4 6:5 7:6  
    5 :      |            | 3:6 7:6 6:5  

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

See also

table fill horizontally
table substitute vertically