ARRAY_POSITIONS

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns an array of the indices of all occurrences of a specified value.

  • <array>: The array to search.
  • <value>: The value to find (must match array element type).

Returns an array of integers that represents all 1-based indices where the value occurs, or an empty array if not found.

Find all positions of a value that appears multiple times.

Returns [2, 4], an array of indices where 3 appears in the array.

Attempt to find positions of a value that doesn't exist.

Returns [], an empty array, because 2 isn't present in the array.