Framework / Formulas / Functions / Functions
Functions
 Functions Overview

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:

  • FUNCTIONNAME - must be a valid function name
  • () - the function name must be followed by an open and close parentheses, even if the function takes no arguments.
  • , - the comma is the only allowed delimiter, which can be used to separate the function arguments.

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:

Array Functions

Bitwise Functions

Date Time Functions

Flow Control Functions

Logical Functions

Mathematical Functions

Measure Functions

Object Functions

Statistical Functions

Text Functions

Trigonometric Functions

Type Functions

Depending on whether a function supports chaining or aggregation, functions can be further classified as Chain_Functions or Aggregate_Functions.

 Chain 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

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.

 

See Also