Choose

Returns one result value, according to the integer value of a test.

Format 

Choose ( test ; result0 {; result1 ; result2...} )

Parameters 

test - Any integer calculation. The calculation result of test must be a number that indexes into the list that follows. Because the index is a 0-based index, the test result must be 0 to access the first result.

result - one or more results.

Parameters in braces { } are optional.

Data type returned 

text, number, date, time, timestamp, container

Originated in version 

6.0 or earlier

Description 

FileMaker Pro evaluates test to obtain an index number, which is used to choose the corresponding ordinal result.

Because the Choose function is a 0-based list, the first item on the list is indexed 0 and the second item on the list is indexed 1. For example, if test evaluates to 2, then result2 is chosen.

Example 1 

Copy
Choose ( Rating ; "Not Applicable" ; "Good" ; "Fair" ; "Poor" )

Rating is a number field that is empty or holds a value. If Rating is empty or 0, the Choose function returns Not Applicable. If Rating is 1, the result is Good. If Rating is 2, the result is Fair, and if it is 3, the result is Poor. If Rating contains a value that does not map to one of the result parameters, the Choose function returns nothing.