List (array) functions
With List (array) functions the Text component must have the Format set to Number.
It is possible to count number of items in list.
Returns maximum value of list of elements or separate field values.
or
Returns minimum value of list of elements or separate field values.
or
It is possible to calculate sum of table column using following code.
The sumproduct function multiplies the corresponding items in the arrays and returns the sum of the results.
It is possible to calculate average of table column using following code.
Use "Number" formatting when creating calculations or using sum, average, sumproduct functions.
The join(delimiter, array) function concatenates field values with specified separator. Last argument is always used as the separator.
Iterates over list of elements and executes expression for each element. Returns new list.
Filters a list of elements by executing the given expression for each element. Returns new list.
Collects unique values from and counts them. Returns new list with following structure:
Flattens list.
The function sort([array], [expression], [direction])) allows you to sort list of elements by the key value. The direction can be either ASC or DESC. The function returns new array with sorted items.
Count
It is possible to count number of items in list.
{% count({line_items}) > 3 ? 'More than three' : 'Less than three' %}
Max
Returns maximum value of list of elements or separate field values.
{% max({line_items::quantity}) %}
or
{% max({dataField1}, {dataField2}, ..., {dataFieldN}) %}
Min
Returns minimum value of list of elements or separate field values.
{% min({line_items::quantity}) %}
or
{% min({dataField1}, {dataField2}, ..., {dataFieldN}) %}
Sum
It is possible to calculate sum of table column using following code.
{% sum({line_items::amount}) %}
Sumproduct
The sumproduct function multiplies the corresponding items in the arrays and returns the sum of the results.
{% sumproduct({line_items::amount},{line_items::price}, {line_items::anotherColumn}) %}
Average
It is possible to calculate average of table column using following code.
{% avg({line_items::amount}) %}
Use "Number" formatting when creating calculations or using sum, average, sumproduct functions.
Join
The join(delimiter, array) function concatenates field values with specified separator. Last argument is always used as the separator.
{% join(";", {field1}, {field2}, {field3}, ..., {fieldN}) %}
{% join(";", [{field1}, {field2}, {field3}, ..., {fieldN}]) %}
Iterate list of elements (array map)
Iterates over list of elements and executes expression for each element. Returns new list.
{% iterate({line_items}, 'quantity*price') %}
{% map({line_items}, 'quantity*price') %}
Filter list of elements
Filters a list of elements by executing the given expression for each element. Returns new list.
{% filter({line_items}, 'price > 10.1') %}
Collect unique values from list
Collects unique values from and counts them. Returns new list with following structure:
[{"value": "Value", "count": 3, "raw_value": "Value"}, {"value": "Value 2", "count": 1, "raw_value": "Value 2"}]
{% collect_unique_values({array}, {array_of_values_to_exclude}, {expression_to_execute_for_each_item}) %}
Flatten list
Flattens list.
{% flatten(iterate({orders}, "{line_items}")) %}
Sort list
The function sort([array], [expression], [direction])) allows you to sort list of elements by the key value. The direction can be either ASC or DESC. The function returns new array with sorted items.
{% sort({line_items}, "quantity", "DESC") %}
{% sort({line_items}, "quantity*price", "ASC") %}
{% sort({line_items}, "quantity > 10 ? 1 : 0", "ASC") %}
Updated on: 18/12/2022
Thank you!