pick()

Function group Execute on client Platform(s)
Lookup YES All

Syntax

pick(number,value0,value1[,value2]...)

Description

Selects an item from a list of values (strings or numbers) using number as a zero-based index and returns the result.

The number argument is rounded to an integer and used to select the item. value0 is returned if the result is 0, value1 if the result is 1, value2 if the result is 2, and so on. If the number is less than zero or greater than the number of values in the list, an empty value is returned. Note the list of values can be a mixture of string and numeric values.

Example

Calculate lResult as pick(lVar1,123,'ABC','abc')
; returns 123 if lVar1 evaluates to 0


Calculate lResult as pick(lVar2,2200,4500,6800)
; returns 6800 if lVar2 evaluates to 2


Calculate lResult as pick(lVar3,'one',2,'three')
; returns empty if lVar3 evaluates to 5