Table Columns (Func. Param. Type)

Prev Next

Introduction

Whenever a function expects a function parameter for table columns, the following types are supported:

Type Description Example
Numeral Specifies a table column number, beginning with 0. Negative indexing is allowed, i.e. -1 is last column in the top row, counting leftward. 0 (left most column)
-2 (2nd. last column)
Quoted string The content of the entire string is interpreted as one header name, even if it contains numbers.
Empty strings ("") refer to the first column with blank header name.
"Last,First Name" refers to one header name
"" is a blank header name
Softquoted string The content of the entire string is interpreted as one header name, even if it contains numbers.
Empty strings ('') refer to the first column with blank header name.
shifted table column specifications are allowed here to reference neighboring columns.
Two consecutive points ('..') define column ranges in order to cover multiple consecutive columns
Some function-specific exceptions may apply and are explicitly documented in the function library documentation.
'Last,First Name' refers to one header name
'' is a blank header name
Set Sets contain a collection of header names and/or column numbers { 1, Last Name, first Name, "Value [EUR]" }

Column Ranges

'..' provided as softquoted string defines a range covering multiple columns in a from..to approach.

  • '..' specified alone selects all columns as defined in the header row.
  • Column, '..' includes the specified column plus all further ones to the right.
  • '..', Column includes the first column till the specified column.
  • Column A, '..', Column B specifies all columns between and including the specified columns. If the first column lies further to the right to the second column, then no columns will be included.
  • Multipe column ranges are allowd, e.g. { a, '..', b, c, '..', d }.


Items to watch out for.

  • Two consecutive ranges { a, '..' ,'..', b } are not permiited and result in exceptions.
  • Ranges on both sides of a specified column { a, '..', 'b', '..', 'c'} are not permitted and flag exceptions.
  • Ranges in quoted strings are interpreted as header names to look for, e.g. { a, "..", b }. The example looks for a header containing "..".
  • Following syntax will not work unless you want to create a set containing typical ranges: {a .. e} which translates into { a,b,c,d,e }.
  • Following syntax is wrong and flags a syntax error as .. is the B4P range symbol for sets to be used without commas: {a, .. , b}.

Different ways to specify Column Ranges
table initialize( t, {{ Red, Orange, Yellow, Green, Turquoise, Blue, Purple, Brown, Black, ".." },
                      { Rot, Orange, Gelb,   Grün,  Türkis,    Blau, Purpur, Braun, Schwarz, Joker}} );

echo( table read row( t, { Green, Red }, 1 ) );
echo( table read row( t, { Yellow, '..', Blue }, 1 ) );
echo( table read row( t, { '..' }, 1 ) ); // Reads all columns
echo( table read row( t, { ".." }, 1 ) ); // Reads the column named "..", returning Joker only
echo( table read row( t, { Yellow, '..' }, 1 ) );

echo( table read row( t, { '..', Green }, 1 ) );
echo( table read row( t, { Brown, '..', Green }, 1 ) );  // Returns empty set because Brown lies past Green.
echo( table read row( t, { Yellow, '..', Blue, Brown, '..', Green }, 1 ) );
{'Grün','Rot'}
{'Gelb','Grün','Türkis','Blau'}
{'Rot','Orange','Gelb','Grün','Türkis','Blau','Purpur','Braun','Schwarz','Joker'}
{'Joker'}
{'Gelb','Grün','Türkis','Blau','Purpur','Braun','Schwarz','Joker'}
{'Rot','Orange','Gelb','Grün'}
{}
{'Gelb','Grün','Türkis','Blau'}
Try it yourself: Open LAN_Features_Table_columns.b4p in B4P_Examples.zip. Decompress before use.

Function-Specific Rules

Addtional function-specific rules may apply depending on the function called and are documented accordingly. Below are some examples:

  • Header names must exist
  • Header names may exist (missing ones may be created as additinal columns in the table)
  • Header names must not exist (e.g. to check if specific header names are not used in a specific table
  • Column numbers are allowed, or not allowed
  • Column numbers may only refer to existing colums, or alternatively all columns even if not yet existing
  • Header names or column numbers must be unique
  • etc.


Note: If Table headers contain numbers, then you can find these headers by specifying the numbers as strings, e.g. '10', or { ..., '10'. ...}.