for all current table selected columns
for all table selected columns ( comparison expression, iterator column number, iterator value, iterator counter ) statement;
for all table selected columns ( comparison expression, iterator column number, iterator value, iterator counter ) {statements; }
The loops works through selected columns (where comparisons do match) 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).
Indirect parameter passing is disabled
This function provides a table context for partial table specifications with table name, row number and column number
2-4
No. | Type | Description |
---|---|---|
1 code |
comparison expression :string |
comparison expression This expression is applied to compare the column header names, regardless of row number specified in the 2nd parameter.
The checking is done once before the loop starts. The loop behavior will not be affected if the header names are changed afterwards,
for example renamed. Attention to inserting and deleting columns: The loop has memorized the actual column numbers
(which will not change) and not the header names.
|
Opt. 2 code |
variable :string |
iterator column number This value refers to the current column number |
Opt. 3 code |
variable :string |
iterator header name This value refers to the current column header name |
Opt. 4 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. |
table initialize( animals,
{{ Name, Class, Number of Legs,Surface},
{ Dog, Mammal, 4, Hair }, { Snake, Reptile, 0, Skin }, { Parrot, Bird, 2, Feathers }} );
// Choose all columns with headers containing 's'. The list results for row 2.
with table ( animals, 2 )
{
for all current table selected columns( ('*s*'), column[], header[], i[] )
{
echo( column[],": Column ", column[], " (", header[], ") = ", [column[]] );
}
}
echo;
// The simplified approach: [.] = current table, row and column. [.,0] = current table, column, and row 0
with table ( animals, 2 )
{
for all current table selected columns('*s*')
{
echo( col(), ": Column (", [.,0], ") = ", [.] );
}
}
1: Column 1 (Class) = Reptile
2: Column 2 (Number of Legs) = 0
1: Column (Class) = Reptile
2: Column (Number of Legs) = 0
for all table columns
for all current table columns
for all table selected columns