for all current table columns

Prev Next

Function Names

for all current table columns

Synopsis

for all current table columns ( iterator value, iterator counter ) statement;
for all current table columns ( iterator value, iterator counter ) {statements; }

Description

The loops works through all columns in the table and row number provided in the current context and executes the following statements specified.

Inside the loop, the iterator value (table cell read) and the index will be provided. The number of columns to process is determined by the 2nd function parameter (reference row number).

Call as: procedure

Restrictions

Indirect parameter passing is disabled
This function requires a table context for partial table specifications with table name and row number
This function extends this table context by adding the column number to it.

Parameter count

0-2

Parameters

No.TypeDescription
Opt. 1
code
variable
:string
iterator value

This variable is updated by this function in order to provide the current value taken from the specified table column and referenced row. The variable is always of type 'quoted string', even if containing numbers or dates. You need to convert the type by hand if needed. The interator value can also be referenced using partial table specifications [.], meaning specified row and current column from the current table context. Here, the 'quoted string' rule specified above does not apply.

Opt. 2
code
variable
:string
iterator counter

This variable is updated by this function and provdes the index. It always begins with 0 and continues with 1, 2, etc.

Examples

       table initialize( animals,
               {{ Name, Class, Number of Legs},
                { Dog, Mammal, 4 }, { Snake, Reptile, 0 }, { Human, Mammal, 2 }} );

       with table ( animals, 1 )
               for all current table columns( value[], i[] )
               {
                       echo( i[],". ", [i[],0], ": ", value[] );
               }

       echo(new line, "Example with 0 parameters in 'for all current table columns':", new line);
       // [.] = Current column and row, [.,0] = Current column from header row

       table process ( animals,
               for all current table columns
               {
                       echo( [.,0], ": ", [.] );
               }; echo; );

Output

0. Name: Dog
1. Class: Mammal
2. Number of Legs: 4

Example with 0 parameters in 'for all current table columns':

Name: Dog
Class: Mammal
Number of Legs: 4

Name: Dog
Class: Mammal
Number of Legs: 4

Name: Dog
Class: Mammal
Number of Legs: 4

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

See also

for all table columns
for all table selected columns
for all current table selected columns