VALUE_INDEX_IN_ARRAY
Calculates a 1-based positional index for each non-null value within a sub-array, resetting the index with each new sub-array. This is particularly useful for maintaining context-specific indexes within nested array structures.
Syntax
Arguments
array
array
Type: any
An array of any value types.
Example
Transformation job example
In this example, column orders contains the following two rows:
If we use this in the following job, it will output the query result below:
Query result
The VALUE_INDEX_IN_ARRAY
function calculates the positional index of the value in the products array and returns the following result:
Unlike VALUE_INDEX_IN_ROW
, VALUE_INDEX_IN_ARRAY
resets the count for each products array. Each product is a separate context that provides an index for the position of name or type field in that specific array.
Last updated