col
This function returns the current column number as provided in the table context for partial table specifications.
It is useful to access neighboring row numbers in the same table, for example row()-1 for the row above the current row.
In case nested (i.e. multiple overlaying) table contexts are available, then the the number of levels up can be specified in the
function parameter to obtain the row number of one of the outer table contexts.
Attention: This function will assert an exception (error message) if the table context is not available, or the depth value is too high,
or the table context does not contain a column numer.
Indirect parameter passing is disabled
context for partial table specifications is required
0-1
No. | Type | Description |
---|---|---|
1 input |
numeral | Depth Specifies the depth in case nested partial table specifications is activated. 0 refers to the current table, 1 and bigger values to superior tables. 0 is assumed if no parameter is specified. Default value: 0 (innermost table context) |
Type | Description |
---|---|
numeral | Column number |
table initialize( animals,
{{ Name, Class, Number of Legs,Surface},
{ Dog, Mammal, 4, Hair }, { Snake, Reptile, 0, Skin }, { Parrot, Bird, 2, Feathers }} );
// 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 (Class) = Reptile
2: Column (Number of Legs) = 0