Pivot Engine / Functions / Functions
In This Topic
    Functions
    In This Topic

    You can use functions in expressions 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 arguments of certain types, or arguments that are castable to these types. In the documentation we use a simple prefix before each argument to denote the variant type that the function will internally cast 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 castable to a boolean
    f Variant castable to a floating point number
    n Variant castable to an integer number
    s Variant castable to string
    dt Variant castable to data time
    ts Variant castable to time span
    arr Variant array

    The currently available functions are logically grouped in the following categories:

    Type Functions

    Logical Functions

    Mathematical Functions

    Trigonometric Functions

    Date Time Functions

    Time Span Functions

    Text Functions

    Array Functions

    Bitwise 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:

    The following expression:=UPPER(REPLACE(ARRAY("#nevron#","#chart#"),"#","")) will 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:

    The following expression:=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:

    The following expression:=SUM(ARRAY(10,20,30)) returns 60.

    The following expression:=JOIN(ARRAY("nevron","chart")," ") returns "nevron chart".

    A function may have more than one argument that is used in the aggregation. For example:

    The following expression:=SUM(ARRAY(10,20,30),10) returns 70.

    The following expression:=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