table read row
These simple functions reads data from a table where the row number and the header names are specified.
Type conversions rules apply according to the settings done with table configure(). By default, numbers will be read as numbers.
The function call table read row( table name, { Name, Phone }, 5 ); is equivalent to [ table name: { Name, Phone }, 5 ].
Indirect parameter passing is disabled
3
No. | Type | Description |
---|---|---|
1. input |
string | name of new or existing table Table must be existing when using table append... functions. Otherwise, it does not matter. |
2. input |
table columns | Header names and/or column numbers See table columns as function parameters for general ruling for this parameter.
|
3. input |
numeral | Row number Negative indexing is supported. Accessing empty rows or rows below the table end return blank contents in the set. Default value: |
Type | Description |
---|---|
set | data read The set contains the data read in the order of the headers and columns are specified, even if only one header name is specified. |
table initialize ( t,
{ { City, Country, Climate Zone, Average Temperature },
{ Rome, Italy, Mediterranean, 22.3 },
{ Medina, S. Arabia, Desert, 30 },
{ Thule, Greenland, Arctic, -5 } } );
echo( table read row ( t, { Country, City, 3, Climate Zone }, 1 ) ); // Rome
echo( table read row ( t, { Country, City, 3, Climate Zone }, -1 ) ); // Last row: Thule
echo( table read row ( t, { City, 24 }, 2 ) ); // Medina, and blank data (beyond last column)
echo( table read row ( t, { Country, City, 3, Climate Zone }, 10 ) ); // Blank data (outside table)
{'Italy','Rome',22.3,'Mediterranean'}
{'Greenland','Thule',-5,'Arctic'}
{'Medina',''}
{'','','',''}