Skip to content

RemoveAt

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

Removes the element at the given 0-based index from an ARRAY.

RemoveAt(N) returns a new ARRAY with the element at index N dropped. Out-of-range indices are silently ignored — the array is returned unchanged.

The index parameter accepts either a literal integer or a field reference. Field-reference indices are resolved per row from the pipeline values; the referenced field must hold an INT. The transformer also supports infix arithmetic in the index parameter (e.g. :len - 1), which is desugared into a preceding Subtract step.

Available in new mode only.

Parameters

1index Mandatory — accepts: INT, field

0-based index, either as an integer literal or a field reference to an INT-valued pipeline field.

Input type

  • ARRAY

Output type

  • ARRAY

Requires

  • Exactly one ARRAY-typed pipeline input.
  • When index is a field reference the referenced field must hold an INT.

Examples

Remove a fixed position

:array => RemoveAt(0)

Remove a position computed at runtime

:array => RemoveAt(:idx)

Remove the last element via infix arithmetic

:array => RemoveAt(:len - 1)

Errors

  • `RemoveAt': input must be ARRAY-typed
    The pipeline value reaching the rule is not an ARRAY.
  • `RemoveAt': index field:idx' must be an integer`
    The referenced field is not an INT.
  • `RemoveAt': index field:idx' not found in pipeline`
    The referenced field is not present in the current pipeline state.
  • `RemoveAt' is only available in new mode
    New mode is not enabled in etl.conf.

See also

At, InsertAt, ReplaceAt, Remove, Size