csl_pick(X;Y)
Returns a particular element in a given comma-separated list.
Syntax
csl_pick(X;Y)
Input
Argument | Type | Description |
---|---|---|
X |
text | A comma-separated list or the name of a column containing a comma-separated list |
Y |
integer | The index of an element within the comma-separated list |
Return Value
Returns the element in the comma-separated list
X
corresponding to the
index Y
. The index is 1-based (e.g., the first element in the list is
returned when Y
=1).Note: A negative index counts
back from the end of the list (e.g.,
Y
=-1
references the last element in the list).If X
is N/A, the result is N/A.
If |Y
| is greater than the number of elements in the list, the result is
N/A.
Sample Usage
csl_list |
index |
csl_pick(csl_list;index) |
---|---|---|
'dog,cat,bird,horse,hippo,duck' | 2 | 'cat' |
'dog,cat,bird,horse,hippo,duck' | -2 | 'hippo' |
'dog,cat,bird,horse,hippo,duck' | 15 | |
'dog,cat,bird,horse,hippo,duck' | -15 | |
'' | 2 |