table explore
This function explores the table for sub-tables. It will scan through the entire table in a reading-style manner (1st row left-to-right, then 2nd row, etc.)
to identify all sub-tables with contents.
Following criteria must be met for the beginning of the sub-table: X adjacent columns in one row must be non-blank.
If number of starting rows is bigger than 1, then in X adjacent columns at least one of the rows must contain contents.
This allows table recognition in case the header consists of multiple rows and has blank items.
The end of the table is recognized by number of adjacent blank rows below the identified table.
Indirect parameter passing is disabled
2-4
No. | Type | Description |
---|---|---|
1. input |
string | Name of existing table It is assumed that this table contains one or more sub-tables. |
Opt. 2 input |
numeral | Starting rows This parameter specifies the number of top rows where at least one of the rows in each column must be non-blank to recognize begin of the table.
|
Opt. 3 input |
numeral | Ending rows This parameter specifies the number of adjacent blank rows below the last non-blank table row to identify end of table. A value of 2 or bigger tolerates blank rows inside the identified table Default value: 1 |
Type | Description |
---|---|
matrix of numerals | Coordinates of identified sub-tables The matrix of numerals is a set which contains 0, 1 or more sets where each of them refers to a found sub-table and contain 4 numerals:
|
table load( test, "Examples\Table Explore Demo.csv" );
table list ( test );
coords[] = table explore ( test );
echo("Identified ", coords[]{}," sub-tables:");
for all ( coords[], c[], i[] )
{
print(" Table ", i[], ": (", c[]{0}, ", ", c[]{1},") ... ( ", c[]{2}, ", ", c[]{3},") " );
echo (" ('", [test:c[]{0},c[]{1}],"', ...)" );
}
0 : Last Name | First Name | Town | | | Family Name | First Name | Town | | Country
1 : Andersson | Andy | Boston | | | Andersson | Andy | Boston | | USA
2 : Bethel | Betty | Cambridge | | | Bethel | Betty | Cambridge | | U.S.
3 : Charlsson | Charles | Baltimore | | | | | | |
4 : Dickson | Dieter | W. DC | | | | | | |
5 : | | | | | Given Name | Profession | | |
6 : Emmerich | Elana | Brussels | | | Girolamo | Acteur | | |
7 : | | | | Cities | Dominique | Dompteur | | |
8 : | | | | Prague | Dimitri | Clown | | |
9 : | | | | Warsaw | | | | |
10 : | | | | Bucharest | | | | |
11 : | | | | Budapest | | | | |
12 : | | | | Istanbul | | | | |
13 : | | | | Cairo | | | | |
Identified 6 sub-tables:
Table 0: (0, 0) ... ( 2, 4) ('Last Name', ...)
Table 1: (5, 0) ... ( 7, 2) ('Family Name', ...)
Table 2: (9, 0) ... ( 9, 2) ('Country', ...)
Table 3: (5, 5) ... ( 6, 8) ('Given Name', ...)
Table 4: (0, 6) ... ( 2, 6) ('Emmerich', ...)
Table 5: (4, 7) ... ( 4, 13) ('Cities', ...)