Skip to main content

Table functions

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.

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:

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!