Use of the FileMaker Choose Function

FullCityConsulting features a function I have never used.  Dang it.  Now I’ll have to find a way:

As functions go Choose is dead simple, but there are some things to watch out for.

  • The first result is result zero. Even if you never expect a result less than 1, you must provide something for result zero. The example below handles this situation using a pair of quotation marks with nothing between them- a standard way to represent a null result in FileMaker.
  • Choose doesn’t work with negative numbers. You can get around this by wrapping your whole math problem in an Abs() function which gives you the absolute (i.e. non-negative) value of the math problem’s result.
  • Choose ignores fractional values. When comparing the math problem’s answer to the list of possible results, Choose disregards everything to the right of the decimal point. Whether your math problem result is 1, 1.3, or 1.999, Choose is going to select Result 1 as your result.

One practical application of Choose is displaying a different message based on the current day of the week. The DayOfWeek function returns a number from 1 to 7 based on the date in its parameter.DayOfWeek ( Get ( CurrentDate ) ) will tell us the number of the current day. From there FileMaker can choose which message to display.

Essentially, it comes down to letting FileMaker solve a math problem, and then having it display something based upon the result of that problem.  So, if you are dealing with a known set of math outcomes, you can program the resulting message pretty easily.  The choose function has limited but useful functionality.

FileMaker Function of the Week: Choose.

Liked Liked
Need FileMaker Development Help? Or to purchase FileMaker Software?
Contact FM Pro Gurus for help