Data Table Processing Functions
This section describes expression language functions related to processing data tables.
Function | Description | Result Type | Backend Support | Frontend Support | |
addColumns(DataTable table, String format1, String expression1, String format2, String expression2, ...) | Adds one or more columns to the table. Format of the first added column is specified by format1 argument, its value is defined by expression1, etc. Format is encoded into string as specified by format encoding section (visible separators are used). Value for this field is calculated by evaluating the expression that may contain references to the other cells of this table. If row is not specified in the reference, it defaults to the current row (i.e. one for that new field's value is calculated). Example: Returns a new DataTable. Does not change the original table. | DataTable | Yes | Yes | |
addColumnsEx(DataTable table, DataTable columnsToAdd, boolean concurrent) | Similar to the addColumns() function, except the Format and Value of the added columns are specified by a single DataTable argument columnsToAdd. The columnsToAdd table must contain two fields, Format and Value, which will be used as a format string and value expression. Format is encoded into string as specified by format encoding. Value for this field is calculated by evaluating the expression that may contain references to the other cells of this table. If row is not specified in the reference, it defaults to the current row (i.e. one for that new field's value is calculated). Each record can be executed concurrently by setting the concurrent argument. Returns a new DataTable. Does not change the original table. | DataTable | Yes | Yes | |
addRecords(DataTable table, Object field1, Object field2, ...) | Adds one or more records to the table. If supplied table has N columns, first N field arguments will be used to fill the first added record, second N arguments will fill the second one, and so on. If fewer field arguments are provided than there are columns in the table, the remaining columns in the new record(s) will be populated with their default values. Returns a new DataTable. Does not change the original table. | DataTable | Yes | Yes | |
adjustRecordLimits(DataTable table, Integer minRecords, Integer maxRecords) | Adjusts minimum and maximum record number for the table and returns modified table. Additional empty records are added if table has less than minRecords records. Trailing records are removed if table has more than maxRecords records. Returns a new DataTable. Does not change the original table. | DataTable | Yes | Yes | |
aggregate(DataTable|String tableOrMask, String expression, Object initialValue) | Calculates an "aggregate value" for a Data Table (if the tableOrMask argument is a Data Table) or a number of contexts (if the first argument is a String representing a context mask). If the first argument is a Data Table, The expression typically uses two values: the result of the previous calculation, accessible via the Example 1: This expression will calculate the number of online ( Example 2: In this case, the result is calculated by going over the records of the default Data Table (returned by Example 3: The above expression will return maximum value found in the Example 4: The above expression will calculate an average value of the | Object | Yes | Yes | |
array(String fieldName [, Object value1, Object value2,…]) | Creates a single-column, array-style table from the Example: | DataTable | Yes | No | |
cell(DataTable table [, String | Integer field [, Integer row [, Boolean description]]]) | Returns value contained in the cell of Data Table passed in the first argument. Cell is specified by field and row parameters. If row is not specified, value of field in the first row is returned. If field is a number, it is considered to be field index instead of its name. If description parameter is specified and is true, the function returns description of cell value instead of the value itself (only if field format specifies selection values). If field is unspecified, this function returns content of the first cell of the table (e.g. from first field and first row). Example: | Object | Yes | Yes | |
clear(DataTable table) | Removes all records from the table. If minimal record count allowed by the table's format is greater than zero, removes records starting from the end of the table until the minimal record count is reached. Modifies and returns the original table. Returns a new DataTable in case if the original table is immutable. | DataTable | Yes | Yes | |
convert(DataTable table, String format [, Boolean useVisibleSeparators) | Converts table to the format specified by format argument. Format is encoded into string as specified by format encoding section. The optional useVisibleSeparators parameter is true by default, indicating that visible separators are used in the format string. If invisible separators are used, useVisibleSeparators should be set to false. After a new empty table of the specified format is created, the function does its best to copy all data from table to a new table using Data Table smart copy operation. Example: Returns a new DataTable. Does not change the original table. | DataTable | Yes | Yes | |
copy(DataTable source, DataTable target) | Copies as much data as possible from the source table to the target table and returns the target table. Adds/removes records from the target table to match the number of records in the source table (if target table's format allows this). Converts value types wherever necessary. Modifies and returns the target table. Returns a new DataTable in case if the original target table is immutable. | DataTable | Yes | Yes | |
count(DataTable | Number value1 [, DataTable | Number value2, ...]) | Returns the number of numeric values found within the list of provided tables and values. | Integer | Yes | No | |
countBlank(DataTable | Number value1 [, DataTable | Number value2, ...]) | Returns the number of nulls and empty strings found within the list of provided tables and values. | Integer | Yes | No | |
countIf(DataTable table1, String condition1 [, DataTable table2, String condition2, ...]) | Checks each of the provided tables to count values that match conditions. Returns the total count of matching values. A condition is an expression that may refer to the value being checked using “value” environment variable, i.e. via {env/value} reference. | Integer | Yes | No | |
decode(String stringToDecode) | Decodes the Data Table from stringToDecode that was encoded according to data table encoding rules. The function auto-detects table encoding mode accepting tables encoded using both visible and invisible separators. | DataTable | Yes | Yes | |
describe(DataTable table, String field1, String description1, String field2, String description2, ...) | Changes description of field named field1 to description1, etc. Returns resulting table. Example: Returns a new DataTable. Does not change the original table. | DataTable | Yes | Yes | |
description(DataTable table) | Returns description of the table, i.e. result of its Naming Expression evaluation. | String | Yes | Yes | |
distinct(DataTable table) | Removes duplicate records from the table and returns resulting filtered table. Returns a new DataTable. Does not change the original table. | Data Table | Yes | Yes | |
encode(DataTable table [, Boolean useVisibleSeparators]) | Encodes table into a string according to data table encoding rules. | String | Yes | Yes | |
filter(DataTable table, String filterExpression) | Returns a table that contains only those rows of source table that match filterExpression. Example: Returns a new DataTable. Does not change the original table. | DataTable | Yes | Yes | |
getFormat(DataTable table [, Boolean useVisibleSeparators]) | Returns table format as String. Visibility of separators is specified by useVisibleSeparators parameter. If this parameter is not specified, invisible separators are used. | String | Yes | Yes | |
getQuality(Data Table table) | Accepts any table as an argument, and returns the Quality property of the argument table, if it exists. | Integer | Yes | Yes | |
getTimestamp(Data Table table) | Accepts any table as an argument, and returns the Timestamp property of the argument table, if it exists. | Date | Yes | Yes | |
hasField(DataTable table, String field) | Returns true if table has field named field and false otherwise. | Boolean | Yes | Yes | |
intersect(DataTable sourceTable, String fieldInSourceTable, DataTable sampleTable, String fieldInSampleTable [, Boolean filterType]) | Returns a table containing records that are contained in sourceTable except for ones that were found in sampleTable, if filterType is true. Returns a table containing records that are contained in sourceTable except for ones that were not found in sampleTable, if filterType is false or undefined. Records in sourceTable and sampleTable are compared to each other by values of fieldInSourceTable and fieldInSampleTable fields. Returns a new DataTable. Does not change the original sourceTable. | Data Table | Yes | Yes | |
join(DataTable left, DataTable right) | Joins two tables horizontally. Length of a resulting table will be a maximum of left and right table lengths. First columns of resulting table will be taken from the left table, and following columns will be taken from the right table. If the left table has key fields, join function will match records from the right table using those key fields. Returns a new DataTable. Does not change the original left and right tables. | Data Table | Yes | Yes | |
match(Object searchKey, DataTable table [, Integer searchType [, Boolean zeroBased]]) | Returns the relative position of a searchKey in a single-row or single-column table. If the searchType is 1, which is the default, assumes that the table is sorted in ascending order and return the largest value less than or equal to searchKey. If the searchType is 0, returns a position of an exact match in an unsorted table. If the searchType is -1, assumes that the range is sorted in descending order and return the smallest value greater than or equal to searchKey. Returned relative position is one-based by default, but this can be changed by the zeroBased parameter. | Integer | Yes | No | |
print(DataTable table, String expression, String separator) | Calculates expression for every record of the table and appends output to a resulting string separating results by separator. Example: | String | Yes | Yes | |
processBindings(DataTable table) | Executes all data table bindings defined by table's format and returns updated table. Modifies and returns the original table instance. | DataTable | Yes | No | |
records(DataTable table) | Returns number of records (rows) in the table. | Integer | Yes | Yes | |
removeColumns(DataTable table, String column1, String column2, ...) | Removes several columns from the table. Returns a new DataTable. Does not change the original sourceTable. | DataTable | Yes | Yes | |
removeRecords(DataTable table, String fieldToCheck, Object value) | Removes specified records from table, i.e. returns a new table containing all records from original one except those having fieldToCheck equal to value. Returns a new DataTable. Does not change the original sourceTable. | DataTable | Yes | Yes | |
select(DataTable table, String fieldToSelect, String fieldToCheck, Object value) | Scans table row-by-row and checks if value of fieldToCheck is equal to value. If true, returns value of fieldToSelect from current record. If no matching records found in the table, this function returns NULL. Example: | Object | Yes | Yes | |
set(DataTable table, String field, Integer row, Object value) | Changes the value of the table's cell indicated by field and row to value and returns the changed table. Modifies and returns the table. Returns a new DataTable in case if the original table table is immutable. | DataTable | Yes | Yes | |
setMultiple(DataTable table, String field, Object value [, String condition]) | Scans table row-by-row and sets value to field if condition expression is true. Sets value to field for all rows in table if condition is absent. Returns a new DataTable. Does not change the original table. | DataTable | Yes | Yes | |
setNestedField(DataTable table, Object value, String field1, Integer row1 [, String field2, Integer row2, ...]) | Updates a cell of a table's subtable to value. The nested subtable to be updated is pointed by a series of field and row argument pairs. Modifies and returns the table. Returns a new DataTable in case if the original table is immutable. | DataTable | Yes | No | |
setQuality(Data Table table, Integer quality) | Sets the Quality property of the provided table to the indicated quality and returns the resulting table. If the provided quality is NULL, the quality property is removed from the table. Modifies and returns the table. Returns a new DataTable in case if the original table table is immutable. | DataTable | Yes | No | |
setTimestamp(Data Table table, Date timestamp) | Sets the Timestamp property of the provided table to the indicated timestamp and returns the resulting table. If the provided timestamp is NULL, the timestamp property is removed from the table. Modifies and returns the table. Returns a new DataTable in case if the original table table is immutable. | DataTable | Yes | No | |
sort(DataTable table, String field, Boolean ascending) | Sorts table's records according to the natural order of field values. Value of ascending flag specifies sort order. Returns a new DataTable. Does not change the original table. | DataTable | Yes | Yes | |
subtable(DataTable table, Integer firstRecord, Integer recordCount, String field1, String field2, ...) | Accepts a table as an argument and returns another table that contains only fields whose names are specified by field arguments. Format and content are preserved in the returned subtable. If firstRecord is specified (not null), only records starting from zero-based firstRecord index are copied to the resulting table. If recordCount is specified (not null), it limits the number of records to be added to the resulting table. Example: Returns a new DataTable. Does not change the original table. | DataTable | Yes | Yes | |
structure(String fieldNamePrefix [, Object value1, Object value2,…]) | Generates a single-record table, with the number of fields corresponding to the number of Example:
| DataTable | Yes | No | |
table([String format [, Object field1, Object field2, ...]]) | Creates a new table using format encoded into string and an array of parameters. Rules used to fill table with data are covered here. The function auto-detects table encoding mode accepting tables encoded using both visible and invisible separators. Example: If format is not specified, this function creates a table with an empty format (e.g. with no columns). This table can be than extended using other table processing functions. | DataTable | Yes | Yes | |
tableFromCSV(String csv, String header, String delimiter [, String format [, String qualifier [, Integer escapeMode [, String comment]]]]) | Takes a string CSV document as input and converts it into a Data Table. The header parameter defines the content of the first line of the CSV file. The value it can take depends on whether or not format is specified. If format is specified the header can be:
If format is not specified the first line of the CSV file must contain either the names or the descriptions of Data Table fields. The header in this case can be:
The delimiter parameter specifies the character to use as the column delimiter. It must be a single-character string. The table format parameter must be a valid Data Table format encoded into a string. The number of columns specified in format must match the number of columns in the CSV file. The qualifier parameter indicates the character to use as a text qualifier in the data. Default is double quote ("). The escapeMode parameter allows for the escape character to be specified. The escape character allows for the text qualifier character to be used in the data:
The comment character allows for a comment character to be specified. Text following the comment character will be ignored until a newline character. This function works similarly to the CSV Import/Export Options. | DataTable | Yes | Yes | |
tableFromJSON(String json [, Boolean convertUnequalFieldTypesToString]) | Takes a JSON document as an input and converts it into a single-record Data Table where each key-value pair is represented as a separate table field. If convertUnequalFieldTypesToString parameter is specified and set to true the function converts values of columns to string if values of different types are present in those columns. | DataTable | Yes | Yes | |
tableToJSON(DataTable table) | Takes a Data Table as an input and converts it JSON document. | String | Yes | Yes | |
![]() | According to the specification, a JSON object is an unordered set of name/value pairs. Thus, any specific order of elements in resulting JSON document is not guaranteed. | ||||
union(DataTable first, DataTable second [, DataTable third] [, DataTable …]) | Unions two or more tables vertically. Format of the resulting table will be combined from the formats of the input tables. Records of the resulting table will be added in the order of the tables listed in the parameters. Returns a new DataTable. Does not change the original tables. | DataTable | Yes | Yes | |
validate(DataTable table [, Boolean throwErrors]) | Executes table validators to make sure table data is valid. If throwErrors parameter is false or missing, returns null in case of success or error text if validation fails. If throwErrors parameter is true, returns the table itself. Any errors are thrown as a function exception in this case. | Object | Yes | Yes |
Was this page helpful?