Link Search Menu Expand Document


Returns the index of the first element in the indicated array for which the given function returns something other than 0. Index counting starts at 1.

The <function> parameter must be included.


ARRAY_FIRST_INDEX(<function>, <array>)


Parameter Description Supported input types
<function> A Lambda function used to check elements in the array Any Lambda function
<array> The array evaluated by the function Any array

Return Type

ARRAY of the same type as the input array


The following example returns the first value in the levels array that is greater than 2:

	ARRAY_FIRST_INDEX(x -> x > 2, [ 1, 2, 3, 9 ]) AS levels;

Returns: 3