table search header row
This function is particularly useful for imported tables where the headers are not necessarily be located in the top row but somewhere else. To make things worse, the headers of the imported tables may be located in different rows. This function searches for the header row and returns the row number. In contrast to table lift header row(), the table remains untouched.
Indirect parameter passing is disabled
2, 3
No. | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1. input |
string | Name of existing table | ||||||||||||
2 input |
table columns | Existing columns considered part of headers See table columns as function parameters for general ruling for this parameter.
| ||||||||||||
Opt. 3 input |
string | Check header option With this option, you can make the search more restrictive, so wrong arrangements located further up in the table will not be detected first.
Checking option 1 affecting the table headers. Only one option can be chosen. See separate table on next page for more details.
|
Type | Description |
---|---|
numeral | Row number where header row has been found -1 is returned if no header row has been found |
table initialize( 2 tables,
{ { Created by, Nick, Miller, "", Last Update, "31.12.2019" },
{ Tennis, Players, "", "", Squash, Players },
{ Still a, "", "", "", Last Name, First Name, City },
{ Draft, "", "", "", Weber, Abel, 'Wilkes-Barre' },
{ First Name, Last Name, City, and, Tanner, Berta, San Monica },
{ Jane, Dominique, The Bronx, "", Miller, Dominique, Trenton },
{ Jasmine, Nelsson, Francfort, "", Quinn, Alex, Denver },
{ Dominique, Miller, Trenton, "", Jansen, Patricia, Albany } } );
echo("Original table:");
table list( 2 tables );
a[] = table search header row( 2 tables, {First Name, Last Name, City} ); // 'must exist' is default
// Finds header row in the right table (headers are on row 2)
b[] = table search header row( 2 tables, {First Name, Last Name, City}, sequence ); // 'must exist' is default
// Finds header row in the left table (headers are on row 4)
c[] = table search header row( 2 tables, {First Name, Last Name, Town} ); // Not found, returns -1
// Header row will not be found.
echo(a[], " / ", b[], " / ", c[] );
Original table:
0 : Created by | Nick | Miller | | Last Update | 31.12.2019 |
1 : Tennis | Players | | | Squash | Players |
2 : Still a | | | | Last Name | First Name | City
3 : Draft | | | | Weber | Abel | Wilkes-Barre
4 : First Name | Last Name | City | and | Tanner | Berta | San Monica
5 : Jane | Dominique | The Bronx | | Miller | Dominique | Trenton
6 : Jasmine | Nelsson | Francfort | | Quinn | Alex | Denver
7 : Dominique | Miller | Trenton | | Jansen | Patricia | Albany
2 / 4 / -1