position(X;L)

Returns the position of a given value in a specified list.

Syntax

position(X;L)

Input

Argument Type Description
X any The value to find within in the list L

A column name

L any A space or comma-separated literal list of values

All of the values in L must be the same type as X.

Return Value

Returns an integer value corresponding to the position of X in L. If X is not in L, the value returned is one plus the number of items in L.

If X is N/A, the result is N/A. However, if X is the empty string (''), and L contains one or more empty strings, the result is the position of the first empty string in the list.

Sample Usage

X L position(X;L)
'b' 'a' 'b' 'c' 2
100 1,10,100 3
1.9 1.1 1.2 1.3 4
NA 2.1,21.0,1.1,11.0 5
'' '2.1','','1.1','' 2
'' '2.1','21.0','1.1','11.0' 5

Example

Selecting the position of the 'bar' element from the literal list of values supplied to the position() function.

<base table="default.lonely"/>
<willbe name="position_result" value="position('bar';'foo' 'bar' 'baz')"/>

Returns the following table:

Position Result