Flatten List | ARRAY_FLATTEN

Syntax

ARRAY_FLATTEN( [value] )

Parameters

value
An ARRAY of nested ARRAYS to join into a single ARRAY. If not an ARRAY, it will be coerced into an array with the ARRAY method.

Return Value

An ARRAY with all inner items joined into a single ARRAY.

Description

Transform an ARRAY of ARRAYS into a single ARRAY. This method is not recursive. For deep flattening using the ARRAY_FLATTEN_DEEP method instead.

Examples

# VALUE is [[1, 2], [3], [4, 5, 6]]
ARRAY_FLATTEN(VALUE) # returns [1, 2, 3, 4, 5, 6]
# VALUE is [[1, 2], 3, [4, 5, 6], 7]
ARRAY_FLATTEN(VALUE) # returns [1, 2, 3, 4, 5, 6, 7]
Does not do deep flattening.
# VALUE is [[[1, 2], [3]], [[4, 5, 6]], [7]]
ARRAY_FLATTEN(VALUE) # returns [[1, 2], [3], [4, 5, 6], 7]
Coerces the passed in value to an array before performing the operation.
ARRAY_FLATTEN(true) # returns [TRUE]