Skip to content

At

mapping category: array no `||` new-mode: required resultSize: 1

Returns the element of an ARRAY at the given 0-based index as a scalar.

At(N) extracts a single element from an ARRAY value. The pipeline must carry a single ARRAY-typed value; the rule replaces it with a scalar copy of array[N]. Out-of-range indices (negative or >= size) return NULL rather than throwing.

The element type is inherited from the destination CDM field (the rule reports UNKNOWN from mapType to defer typing to the surrounding context).

Available in new mode only.

Parameters

1index Mandatory — accepts: INT

0-based index into the array. Out-of-range indices produce NULL.

Input type

  • ARRAY

Output type

Type matches the destination CDM field; element values are copied out of the array. Out-of-range indices yield NULL.

Requires

  • Exactly one ARRAY-typed pipeline input.

Examples

First element of a collected array

Use(:a, :b, :c)[3] => At(0)

Middle element (test095)

Use(:a, :b, :c)[3] => At(1)

Errors

  • `At': input must be ARRAY-typed
    The pipeline value reaching the rule is not an ARRAY.
  • `At' requires exactly one integer parameter
    Wrong arity or non-integer parameter (e.g. a string or field reference).
  • `At' is only available in new mode
    New mode is not enabled in etl.conf.

See also

InsertAt, RemoveAt, ReplaceAt, Size, Remove