Last updated
Was this helpful?
Last updated
Was this helpful?
The ArraySlice function returns a portion of an array, defined by the starting index and length.
ArraySlice(array, start, length)
The ArraySlice function has the following arguments.
In general, if any of the arguments used by the function is Null
, it returns Null
.
The following examples of ArraySlice function demonstrate how this function works.
array
Required. The input array that Sigma parses to extract a portion as a new array. Must be an array structure; to create single array from a column, use the ArrayAgg function. If this value is Null
, then Analytics Pro does not return an array; see Example. If the array is empty, Analytics Pro returns an empty array; see Example.
array2
Required. The beginning, or the starting index for extracting the new array from the original array. The range of valid valued are from 0
to ArrayLength(array) - 1
. If the value calculates beyond the end of the original array, Analytics Pro returns an empty array, represented as []
. Negative values count from the end of the array, so -2
is the second from the last position in the original array. If this value is negative and the index calculates beyond the beginning of the original array, then the value defaults to 0
. If this value is negative and Analytics Pro applies a Null
value, it does not return an array; column ArraySlice(array, start, length). If both and are Null
, the function does not return an array; it evaluates to Null
. Analytics Pro rounds floating numbers to the nearest integer; see Example, where the applied start is 3
.
length
Optional. The length of the new array. If there is no value (Null
) and Analytics Pro applies it, then it does not return an array; see Example, column ArraySlice(array, start, length) If the value is so large that the ending index calculates beyond the size of the original array, the function extracts from the start index to the end of the original array. See Example. If this value is negative, the function returns an empty array; see Example. If both and are Null
, the function does not return an array; it evaluates to Null
. See Example. Analytics Pro rounds floating numbers to the nearest integer; see Example, where the applied length is 3
.