table find row
This function compares a table by checking the the data in the columns provided with the values provided in the 3rd function
parameter. The comparison is carried in the same way as if the table cells are compared with the values using the equal to sign =.
Depending on the table configiuration (see table configure(), the values retrieved from the table may be converted automatically,
which is in the case for reading numerals in the default case.
Wildcards are supported in the matching patterns if the comparison values are provided as softquoted strings and contain wildcard symbols
and strings are compared. Mismatching types return false, e.g numeric 1 compared with string '1'.
If a row is found, then the row number will be returned. Otherwise, this function returns -1.
Indirect parameter passing is disabled
3-4
No. | Type | Description |
---|---|---|
1. input |
string | Name of existing table |
2 input |
table columns | Header names and/or column numbers to compare See table columns as function parameters for general ruling for this parameter.
|
3 input |
set or string | Comparison values or patterns The nummber of elements must match with the number of headers (2nd function parameter).
Specify the comparison patterns.
|
Opt. 4 input |
numeral | Starting row number The search begins at the specified row number. Negative indexing is supported. Default value: 1 (1st data row) |
Type | Description |
---|---|
numeral | Row number with match found -1 is returned if no match has been found. |
table load( c, "Examples\Cities.csv");
row[] = table find row( c, { City, Country }, { Los Angeles, USA } );
echo("Los Angeles is found in row: ", row[] );
row[] = table find row( c, { City, Country }, { Los Angeles, CAN } );
echo("Los Angeles is not found, returning : ", row[] );
row[] = table find row( c, { City, Country }, { Los Angeles, 'U*' } );
echo("Los angeles is found in row: ", row[] );
row[] = table find row( c, { City, Country }, { Los Angeles, "U*" } );
echo("Los Angeles is not found, returning : ", row[] );
row[] = table find row( c, { Inhabitants, Country }, { 404000, '*' } );
echo("Zürich found in row: ", row[] );
Los Angeles is found in row: 9
Los Angeles is not found, returning : -1
Los angeles is found in row: 9
Los Angeles is not found, returning : 9
Zürich found in row: 12