Reference > Functions reference > Logical functions > Choose
 

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 

FileMaker Pro 6.0 or earlier

Description 

FileMaker Pro Advanced 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 

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.

Related topics 

Functions reference (category list)

Functions reference (alphabetical list)

About formulas

About functions

Defining calculation fields

Using operators in formulas