The table functions return information about the data table which is
currently being read. If no table name is specified and the function is
used within a LOAD statement,
the current table is assumed.
All functions can be used in the data load script, while only NoOfRows can be used in a chart expression.
Use the drop-down on each function to see a brief description and the syntax of each function. For some of the functions, you can get further details about that specific function by clicking the function name in the syntax description.
The FieldName script function returns the name of the field with the specified number within a previously
loaded table. If the function is used within a LOAD statement, it
must not reference the table currently being loaded.
The FieldNumber script function returns the number of a specified field within a previously loaded
table. If the function is used within a LOAD statement, it must not reference
the table currently being loaded.
The NoOfFields script function returns the number of fields in a previously loaded table. If
the function is used within a LOAD statement, it must not reference the
table currently being loaded.
The NoOfRows function returns the number of rows (records) in a previously loaded table.
If the function is used within a LOAD statement, it must not reference
the table currently being loaded.
This script function returns
the number of tables previously loaded.
NoOfTables()
This script function returns the name of the table with the specified number.
TableName(table_number)
This script function returns the number of the specified table. The first table has number 0.
If table_name does not exist, NULL is returned.
TableNumber(table_name)
Example:
In this example, we want to create a table with information about the tables and fields that have been loaded.
First we load some sample data. This creates the two tables that will be used to illustrate the table functions described in this section.
Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;
ASCII:
Load
if(RecNo()>=65 and RecNo()<=90,RecNo()-64) as Num,
Chr(RecNo()) as AsciiAlpha,
RecNo() as AsciiNum
autogenerate 255
Where (RecNo()>=32 and RecNo()<=126) or RecNo()>=160 ;
Next, we iterate through the tables that have been loaded, using the NoOfTables function, and then through the fields of each table, using the NoOfFields function, and load information using the table functions.
//Iterate through the loaded tables
For t = 0 to NoOfTables() - 1
//Iterate through the fields of table
For f = 1 to NoOfFields(TableName($(t)))
Tables:
Load
TableName($(t)) as Table,
TableNumber(TableName($(t))) as TableNo,
NoOfRows(TableName($(t))) as TableRows,
FieldName($(f),TableName($(t))) as Field,
FieldNumber(FieldName($(f),TableName($(t))),TableName($(t))) as FieldNo
Autogenerate 1;
Next f
Next t;
The resulting table Tables will look like this:
Load table
Table
TableNo
TableRows
Field
FieldNo
Characters
0
26
Alpha
1
Characters
0
26
Num
2
ASCII
1
191
Num
1
ASCII
1
191
AsciiAlpha
2
ASCII
1
191
AsciiNum
3
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!