Pivot Engine / Functions / Array Functions
In This Topic
    Array Functions
    In This Topic
    Syntax Description Example
    ARRAY(var1[, var2, varN]) Returns an array of the enumerated variants. If any of the arguments is an array it is embedded in the returned array.

    ARRAY(10,20,30)
    Returns: a variant array containing the 10,20 and 30 variants.

    ARRAY(10,ARRAY(20,30),40)
    Returns: a variant array containing the 10,20 30 and 40 variants.

    COUNT(var1[, bCountEmpty]) Returns the count of values in a list. Optionally you can specify whether to count the empty values or not. By default empty values are counted.

    COUNT(ARRAY(10,10,30))
    Returns: 3

    COUNT(ARRAY(EMPTY(),10,30))
    Returns: 3

    COUNT(ARRAY(EMPTY(),10,30), false)
    Returns: 2

    COUNTDISTINCT(var1[, bCountEmpty]) Returns the count of distinct values in a list. Optionally you can specify whether empty variants are counted or not. By default empty values are counted.

    COUNTDISTINCT(ARRAY(10,10,EMPTY()))
    Returns: 2

    COUNTDISTINCT(ARRAY(10,10,EMPTY()), false)
    Returns: 1

    FIRST(var1[, nonEmpty]) Returns the first value from a list. Optionally you can specify whether the first non empty value must be returned. By default return the first value regardless of its type (e.g. nonEmpty is by default false).

    FIRST(ARRAY(EMPTY(),20,30))
    Returns: empty

    FIRST(ARRAY(EMPTY(),20,30), true)
    Returns: 20

    GETAT(arr,nIndex) Returns the value in the list at the specified index.

    GETAT(ARRAY(10,20,30),2)
    Returns: 20

    LAST(var1[, nonEmpty]) Returns the last value from a list. Optionally you can specify whether the last non empty value must be returned. By default returns the last value regardless of its type (e.g. nonEmpty is by default false).

    LAST(ARRAY(10,20,EMPTY()))
    Returns: empty

    LAST(ARRAY(10,20,EMPTY()), true)
    Returns: 20