Array Functions
This cheat sheet is a quick reference for array functions that are frequently used in data analysis and programming. Each function has its syntax, a sample and a short description.
ARRAYSORT
The ARRAYSORT function sorts an array result from links or lookup.
Syntax
ARRAYSORT(array, ["asc" | "desc"])Sample
ARRAYSORT({LookupField}, "desc")Remark
ARRAYSORT sorts an array result from a links or lookup field.
The 2nd parameter is the sort order: "asc" sorts the values ascending, and "desc" sorts them descending. If you do not give this parameter, the default is "asc".
ARRAYUNIQUE
The ARRAYUNIQUE function returns the unique items from the given array.
Syntax
ARRAYUNIQUE(array)Sample
ARRAYUNIQUE({Field})Remark
ARRAYUNIQUE removes duplicate values from the given array. Only unique items stay.
ARRAYCOMPACT
The ARRAYCOMPACT function removes null and empty values from the result.
Syntax
ARRAYCOMPACT(array)Sample
ARRAYCOMPACT({Field})Remark
ARRAYCOMPACT removes null and empty values from the given array. Only visible items stay.
ARRAYSLICE
The ARRAYSLICE function takes part of an array, from the start to the (optional) end.
Syntax
ARRAYSLICE(array, start, [end])Sample
ARRAYSLICE({Field}, 2, 3)Remark
ARRAYSLICE takes part of the array value, from the start to the (optional) end.
| Parameter | What it does |
|---|---|
| 2nd parameter | The start index. The index starts at 1. |
| 3rd parameter | The end index. In the sample above, the function takes array values 2 and 3, a total of 2 items. If you do not give the end index, the function takes all items from the start index to the end. |
The start index and the end index cannot be negative. The end index must be equal to or bigger than the start index. If these rules are not met, the result is empty.
Last updated on