Framework > Formulas > Functions > Functions |
You can use functions in formulas to perform additional tasks. Most functions require a set of input arguments, but all functions evaluate to a single variant value. All functions share the following general syntax:
FUNCTIONNAME(arg1,arg2,...argN)
where the following rules apply:
Some arguments of a function may be optional. These arguments are enclosed in square brackets ("[" and "]").
Certain functions would expect specific arguments to be of a certain type, or convertible to that type. In the documentation we use a simple prefix before each argument to denote the variant type that the function will internally convert the variant to. Following is a list of the used prefixes:
Prefix | Description |
---|---|
var | Any variant. The documentation states if there are other limitations. |
b | Variant convertible to boolean |
n | Variant convertible to number |
m | Variant convertible to measure |
nm | Variant convertible to number or measure. |
s | Variant convertible to string |
dt | Variant convertible to data time |
arr | Variant array |
The currently available functions are logically grouped in the following categories:
Depending on whether a function supports chaining or aggregation, functions can be further classified as Chain_Functions or Aggregate_Functions.
Chain functions are functions, which can perform operations on the variants contained in an array and return an array than contains transformed variants. Chaining helps you perform a series of transformations on the variants contained in one array, by passing the function result as an argument to another chain function. For example:
UPPER(REPLACE(ARRAY("#nevron#","#chart#"),"#","")) - return an array containing "NEVRON" and "CHART". First, the REPLACE function has removed all occurrences of '#' in all strings and then the UPPER function converted all strings to upper case.
Chain functions support passing a non array variant too. For example:
UPPER(REPLACE("#nevron#","#","")) - returns "NEVRON".
In the documentation the arguments on which a function supports chaining are highlighted in blue.
Aggregate functions are functions, which take an array(s) of values and return a single value - i.e. aggregate a set of values in some way. For example:
SUM(ARRAY(10,20,30)) - returns 60.
JOIN(ARRAY("nevron","chart")," ") - returns "nevron chart".
A function may have more than one argument that is used in the aggregation. For example:
SUM(ARRAY(10,20,30),10) - returns 70.
SUM(ARRAY(10,20,30),ARRAY(10,20,30,10)) - returns 130.
In the documentation the arguments on which a function supports aggregation are highlighted in red.