Blog

Software tips, techniques, and news.

FileMaker While Function

Sometimes smallest features offer the biggest impact. The new While function, which gives the ability to loop within a calculation, drastically reduces the need for one-off recursive custom functions, speeding up development in any part of FileMaker that requires looping in a calculation. Let's take at how it works.

youtube-preview

How It Works

The format of a while function is broken into four parts: initial variables, the condition, logic, and the results. The function repeats the logic section until the condition is false; that is how the function provides the ability to loop. In the example below the While function returns a list of numbers 1 through 5:

While (
    [
     count = 1;
     numberList = ""
    ];
    count < 6 ;
    [
     numberList = numberList & (count) & "¶";
     count = count + 1
    ];
numberList
)

The function returns:

1
2
3
4
5

Notes

  • Initial variables are available throughout the loop of the function.

  • You can define multiple initial variables by enclosing them in brackets, similar to how let functions work.

  • Variables that need to retain information from each iteration must be defined in the initial variable section otherwise their values are empty in the next iteration.

  • To prevent infinite loops the while function will return "?" after the number of iterations exceeds a limit.

  • The default limit is 50,000 iterations. Use the new function, Set Recursion, to set a new limit to the number of iterations.

Conclusion

With the advent of the While function, development of FileMaker applications will become a simpler and quicker process, eliminating the need for one-off recursive functions. Download the demo file to try out the new function!

Contact us if you have any questions about the While function or need help implementing your FileMaker solution.

Did you know we are an authorized reseller for Claris FileMaker Licensing?
Contact us to discuss upgrading your Claris FileMaker software.

Download the FileMaker While Function File

Please complete the form below to download your FREE FileMaker file.

First Name *
Last Name *
Company
Email *
Phone *
FileMaker Experience *
Agree to Terms *
devin drake headshot.
Devin Drake

Devin is a certified FileMaker and web developer who is outgoing, easily approachable, and places a high value on collaboration and supporting others.