Array Functions
Array functions provide mechanisms for processing and evaluating the contents of arrays.
The examples for each function use the following notation:
- Square brackets (
[]
) indicate arrays. - Curly braces (
{}
) indicate groups. - Arrows (
==>
) separate inputs and outputs. Inputs are shown on the left side of the arrow. Outputs are shown on the right side of the arrow.
Combine
The Combine
function combines (and optionally deduplicates) the submitted arguments into a single array. They are concatenated in the order that they are supplied to the function.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | var : An array or set of any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers |
|
Output Datatype(s) | An array matching the datatype of the input. |
All input must share the same datatype, except for integers and floats. Integers and floats can both be inputs in the same function. If both integers and floats are received as inputs, the output is an array of floats.
Arrays and scalar values may be inputs in the same function. Sets and scalar values may also be inputs in the same function.
Examples
combine(1,2,3) ==> [1,2,3]
combine(1,2.4,3) ==> [1.0,2.4,3.0] // Mixture of int and float input results in a float array
combine([1,2,3],[4,5,6],[7,8,9,10]) ==> [1,2,3,4,5,6,7,8,9,10]
combine([1,2,3],10,[4,5,6]) ==> [1,2,3,10,4,5,6]
combine({1,2,3},{4,5,6},{7,8,9}) ==> {[1,4,7],[2,5,8],[3,6,9]}
combine({[A],[B],[C]},{[D],[E],[F]}) ==> {[A,D],[B,E],[C,F]}
combine({1,2,3},10,{4,5,6}) ==> {[1,10,4],[2,10,5],[3,10,6]}
Sort
The Sort
function sorts an array, rearranging its elements in either ascending or descending order as specified.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : An array or set of datetimes, integers, floats, or strings.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | order (Default: asc ): Specifies whether to sort in ascending (asc ) or descending (desc ) order. |
Output Datatype(s) | An array matching the input datatype. |
Examples
sort([1,4,5,3,2]) ==> [1,2,3,4,5]
sort({["C","A"],["D","E"]}) ==> {["A","C"],["D","E"]}
Unique
The Unique
function returns an array containing the unique values of the input array.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : An array of any datatype, or a Group of Arrays of any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | ignore null (Default: True ): If True , null values are not included in the output (even if there is only one null value). If False , any unique null values are included in the output. |
Output Datatype(s) | An array matching the input datatype. |
Examples
unique([1,2,2,3,3,4]) ==> [1,2,3,4]
unique({["1","2","2","3","3","4"],["A","B","B","b","C"]}) ==> {["1","2","3","4"],["A","B","b","C"]}
Value At
The Value At
function returns the value at the specified index position of the input array. It uses a 0-based index.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes | arg : An array of any datatype, or a Group of Arrays of any datatype.
index : An integer or set of integers specifying the index position.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Same as input datatype. |
If the input array does not have an index at the submitted index position, the function returns null
.
Examples
valueAt([2,7,4,6,1,2],2) ==> 4
valueAt([2,7,4,6,1,2],10) ==> null
valueAt([2,7,4,6,1,2],{0,1,2}) ==> {2,7,4}
valueAt([2,7,4,6,1,2],[0,1,2]) ==> [2,7,4]
valueAt({[2,7,4,6,1,2],[1,2,3],[4,5,6]},2) ==> {4,3,6}
valueAt({[2,7,4,6,1,2],[1,2,3],[4,5,6]},{1,2,3}) ==> {7,3,null}