CHOOSE
Chooses a string from a list of strings based on a given position. You specify the position and the value. If the value matches the position, the Data Integration Service returns the value.
Syntax
CHOOSE( index, string1 [, string2, ..., stringN] )
The following table describes the arguments for this command:
Argument | Required/ Optional | Description |
---|
index | Required | Numeric datatype. Enter a number based on the position of the value you want to match. |
string | Required | Any character value. |
Return Value
The string that matches the position of the index value.
NULL if no string matches the position of the index value.
Example
The following expression returns the string ‘flashlight’ based on an index value of 2:
CHOOSE( 2, 'knife', 'flashlight', 'diving hood' )
The following expression returns NULL based on an index value of 4:
CHOOSE( 4, 'knife', 'flashlight', 'diving hood' )
CHOOSE returns NULL because the expression does not contain a fourth argument.