Table functions
Function | Description | Example Expression | Example Result |
| Returns the number of rows in a table. |
| 2 |
| Returns a truth (Boolean) value indicating whether the table has any rows. |
| TRUE |
| Returns a table where first n rows have been excluded. |
| <[col: "B"] & [col: "C"]> |
| Returns a table where first n rows are included in result. |
| <[col: "A"] & [col: "B"]> |
| Returns a record representing the first row of a table. |
| <[col: "A"] as Record> |
| Returns the summarized value of the specified table column. |
| 11 |
| Returns a Boolean value indicating whether the predicate expression holds tree for all rows in the table. |
| false |
| Forces evaluation of a lazy table expression. Rarely necessary. | Eval(numbers where x < 0) | <numbers table unchanged> |
| Creates a Flow table from a string value containing CSV data. | See below | See below |
| Creates a Flow table from a string value containing XML data | See below | See below |
The WHERE keyword
You can use the WHERE keyword to create a filtered version of a table variable. Since this filtering happens locally on the device where the Flow client is run, it is not suitable for large amounts of data.
The WHERE keyword takes a table on the left hand side and a logical expression (with the scope of the table's columns) on the right hand side.
Since the WHERE keyword returns a new table, you can nest it in any table function, such as First
, Any
, Count
, etc.
The ORDER BY keyword
ORDER BY sorts a table by one column and returns a new sorted table. As default the order is asending but by adding the keyword DESC the order can be changed to descending (ASC can be added for explicitly when sorting ascending). Only simple types can used for sorting.
The SUM function
The Sum function calculates the sum of the values in a numeric column in a table.
The JOIN function
The Join function concatenates all values of a table column into a single textual value with a given separator.
In the example below, the orderNo column of the orders table is aggregated into a comma-separated string in the format <orderNo 1>, <orderNo 2>, <orderNo 3>
etc.
The MAP-AS construct
The Map-As construct is used to create a new table variable based on an existing table variable, changing the column names and adding or removing new columns. The syntax of the map-as construct is MAP <source table> AS <record literal>
. The record literal to the right of the AS keyword has the scope of the table.
The example below shows an orderLines table being transformed, keeping the salesPart column but adding a new column called cost, which is calculated using the price and discountPercent columns of the orderLines table.
CSV data
The CsvFill function can be used to parse CSV data into a Flow table. In order to do this, the function needs a prototype table, which is an empty table specifying the columns expected in the CSV data. If not all columns are present in the CSV data, the function will fail.
Given the following semicolon-separated CSV:
...you can use the CsvFill function as such:
XML data
Similarly, the XmlFill function can be used to parse simple XML data into a Flow table. In order to do this, the function needs a prototype table, which is an empty table specifying the columns expected in the XML data. If not all columns are present in the XML data, the function will fail.
The third argument of the XmlFill function can be used to specify an XPath expression pointing out the root element under which each row is found.
Given the following XML:
...you can use the XMLFill function as such:
Last updated