The FileMaker Choose Function

From Dwayne Wright PMP
Certified FileMaker Developer

TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit or other formatting of the posting may fail. For the best experience, please visit the journal directly by clicking (here)

Choose( test ; result0 {; result1 ; result2)
FMP Version: All Current Versions

Choose is a neat little function that seems a little odd, at first. It first will perform a test and return a number that is equal to or greater than zero. Then it will follow with a number of expressions that will link to that number.

EXAMPLE: Let us use the choose function to return the name of a day of the week. So my goal here is not to have you forsake the DAYNAME function but to illustrate a useful example of the CHOOSE function.

Let me say that I have a field called Date Global on a layout. I have a value list attached to it with a pull down menu. The menu allows you to put 1 through 7 into the global field. Using the CHOOSE function, we will need to do a test, which will provide a number between zero and seven. We will need to provide 8 results, because zero to seven has 8 different combinations ( 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 ). So our calculation will look something like this ...

Choose(NumberGlobal, "","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")

So when the NumberGlobal field has a zero in it, the function returns nothing (otherwise known as “”).

When the NumberGlobal field has a 1 in it, the choose function goes from left to right, first to the zero return, then to the first return and sees that we want to say Sunday and that is what it returns. The logic continues with 2 in the global field returning Monday, 3 returning Tuesday and all the way up to 7 which will return a Saturday.

A more real world example of the above calculation would be ...
DayofWeek(Date Global), "","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")

Here you would be having the date global field have any date and you would know what day of the week it is. So you can see, CHOOSE can be a very elegant and flexible logic function. This is because we can right one test to provide a numeric result. We do not need to have multiple tests like you would if a nested IF statement or a Case function. If our number of options increases, we simply need to write more results because the tests take care of themselves.

UPDATE - JULY 29, 2012
I rarely use this function, so rare that I forgot one of its quirks today. I complete forgot that each of the result parameter options needs to have quotes around it. I was working on a randomizer that would pick a right answer choice in my revamped quiz product. I wanted to have the system pick where the right answer should be so that I won't fall into any unintentional patterns. Here is the correct calculation I used ...

Choose ( Round ( Random  * 3 ; 0 ) ; "A","B","C","D" )

More info about the author and FileMaker in general, contact me at

© 2007 - Dwayne Wright -

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.