Array Slice ([start:end])

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns a subarray within specified bounds from an array.

Syntax 

1(<ARRAY>)[<start>:<end>]

Arguments 

Required 

  • <array>: The array to slice.
  • <start>: The starting index.
  • <end>: The ending index.

Returns 

Returns an array that contains elements from the start index to the end index (inclusive).

Considerations 

  • Both bounds are inclusive and 1-based.
  • If bounds exceed the array length, the result is limited to available elements.

Examples 

Extract Subarray 

Extract elements from index 2 to 3.

1SELECT (ARRAY[1, 2, 3])[2:3] AS subarray;

Returns [2, 3], a subarray containing the elements at positions 2 and 3.

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!