Columnal Documentation: Table of Contents

list functions

list lengthelementelement orget singlejoin lists
list length(list)length Type: For any types t([t]) -> Number

Gets the number of elements in the given list.

ExamplesClick an example to insert it
list length(["a", "word", "list"])3
list length([2, 4, 6, 8])4
list length([])0
element(list, position)list item Type: For any types t([t], Number) -> t

Gets the list element at the given position (first position is 1).

ExamplesClick an example to insert it
element(["x", "y", "z"], 1)"x"
element([2, 4, 6, 8], 4)8
element([], 1)error
element([true, false], 0)error
element or(list, position, default)list item Type: For any types t([t], Number, t) -> t

If the number is within the bounds of the list, gives back the element at that position (e.g. 3 gets the 3rd item in the list). But if the number is 0 or less, or greater than the list size, the third parameter will be returned instead.

This is particularly useful for accessing the previous row of a column and avoiding an error on the first element, for example element or(table\\Table#Totals, row - 1, 0) in a Calculate will give the value from the Totals column in the previous row, or 0 if this is the first row of the table.

ExamplesClick an example to insert it
element or(["a", "b"], 0, "z")"z"
element or([7, 8, 9], 3, 0)9
element or([true, true, true], 5, false)false
get single(list)single item Type: For any types t([t]) -> t

If this list has exactly one element, returns it. Otherwise gives an error.

This is useful if you have a table where you store single values. The column is a list, so you need to use a function, like single, to fetch out the one item in it.

ExamplesClick an example to insert it
get single([65])65
get single([])error
get single([1, 2])error
join lists(list of lists)joined lists Type: For any types t([[t]]) -> [t]

Takes a list of lists, and joins them into one list by joining them end-to-end.

Each item in the passed list must be a list. To include single items, wrap them in square brackets [].

ExamplesClick an example to insert it
join lists([[0, 1], [3, 4], [7]])[0, 1, 3, 4, 7]
join lists([[true], [], [false]])[true, false]
join lists([])[]