Excerpt |
---|
Computes the number of elements in the arrays in the specified column, array literal, or function that returns an array. |
- This function calculates the number of elements in the outer layer of an array. If your array is nested, the count of inner elements is not factored.
- If a row contains a missing array, the returned value is
0
. If it contains a value that is not recognized as an array, the returned value is blank.
Array literal reference example:
D lang syntax |
---|
RawWrangle | true |
---|
Type | ref |
---|
showNote | true |
---|
WrangleText | derive type:single value:arraylen([A,B,C,D]) |
---|
|
arraylen([A,B,C,D]) |
Output: Returns the count of elements in the array, which is 4
.
Column reference example:
D lang syntax |
---|
RawWrangle | true |
---|
Type | ref |
---|
showNote | true |
---|
WrangleText | derive type:single value:arraylen([myValues]) as:'length_myValues' |
---|
|
arraylen([myValues]) |
Output: Returns the count of elements in the myValues
column.
Array function example:
D lang syntax |
---|
RawWrangle | true |
---|
Type | ref |
---|
showNote | true |
---|
WrangleText | derive type:single value:arraylen(concat([colA,colB])) as:'length_myValues' |
---|
|
arraylen(concat([colA,colB])) |
Output: Returns the count of elements in the array returned from concatenating colA
and colB
.
D lang syntax |
---|
RawWrangle | true |
---|
Type | syntax |
---|
showNote | true |
---|
WrangleText | derive type:single value:arraylen(array_ref) |
---|
|
arraylen(array_ref) |
Argument | Required? | Data Type | Description |
---|
array_ref | Y | string | Name of Array column, Array literal, or function returning an Array to apply to the function |
array_ref
Name of the array column, array literal, or function returning an array whose elements you want to count.
- Multiple columns and wildcards are not supported.
Required? | Data Type | Example Value |
---|
Yes | String (column reference or function) or array literal | myArray1 |
Example - Unnest an array
Include Page |
---|
| EXAMPLE - Flatten and Unnest Transforms |
---|
| EXAMPLE - Flatten and Unnest Transforms |
---|
|