Choose()

 <  Day Day Up  >  

Choose()

Category: Logical

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

Parameters: test ”an expression that returns a number greater than or equal to zero; result(n) ”the expression that is evaluated based on the result of test. Parameters in curly braces {} are optional.

Description: Returns one of the result values, according to the integer value of test . 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 . Any fractional value of test is ignored when obtaining the index number.

Examples:

 

 Choose( DayOfWeek( Get (CurrentDate)) ; ""; "Sun"; "Mon"; "Tue"; "Wed"; "Thu"; "Fri"; "Sat") 

Returns a three-letter day name abbreviation for today's date.

The following formula converts decimal values to fractional notation, rounded to the nearest eighth .

 

 Let ([   n = myNumber; int = int(n); decimal = mod(n ; 1);   numberOfEighths = Round(decimal / .125 ; 0);   intDisplay = If (int; int & If(decimal ; " - "; ""); "")] ;   Choose(numberOfEighths;     Floor (n);     intDisplay & "1/8";     intDisplay & "1/4";     intDisplay & "3/8";     intDisplay & "1/2";     intDisplay & "5/8";     intDisplay & "3/4";     intDisplay & "7/8" ;     Ceiling(n)) ) 

If myNumber contained 3.45, this function would return 3 - 1/2 .

Comments:

If the index value returned by test exceeds the number of results available, the Choose function will not return a result. There is no way to define a default value to use when the index value exceeds the number of results available.

 <  Day Day Up  >  


QUE CORPORATION - Using Filemaker pro X
QUE CORPORATION - Using Filemaker pro X
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 494

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net