Link Search Menu Expand Document

ELEMENT_AT

Returns the element at a location <value> index from the given array. Indexes in an array begin at position 1.

Syntax

ELEMENT_AT(<array>, <value>)

Parameters

Parameter Description Supported input types
<array> The array that the function is applied to. ARRAY of any type
<value> The index that is matched by the function.
Negative indexes are supported. If used, the function selects the corresponding element numbered from the end. For example, array[-1] is the last item in the array.
INTEGER

Return Types

Same as the element data type of the input array

Example

The following example displays the player’s current level by returning the element at the index of 2:

SELECT
	ELEMENT_AT([ 1, 2, 3, 4 ], 2) AS current_level;

Returns: 2