While() for iterative loops in FileMaker calculations (FM 19+)
ExpertIntroduced in FileMaker 19, While() enables iterative loops entirely within a calculation — no scripts required. Learn the four-argument syntax, accumulator patterns, and when to use While() vs a script loop.
What you'll learn
- The four-argument structure of While() and what each argument does
- How to build an accumulator pattern to sum or collect values
- When While() is the right tool vs a scripted loop
While ( initialVariables ; condition ; loopVariables ; result ) runs a loop inside a single calculation, accumulating a result across iterations — eliminating the need for a script loop for many processing tasks.
1/2
1
Understand the While() arguments
While takes four arguments: initial variable declarations, a condition to continue, per-iteration variable updates, and a final result expression.
FileMaker Script
// While ( initialVars ; condition ; loopVars ; result ) // Sum integers 1 through 10 While ( [ i = 1 ; total = 0 ] ; // 1. initial variables i ≤ 10 ; // 2. continue while this is True [ total = total + i ; i = i + 1 ] ; // 3. update each iteration total // 4. result after loop ends ) // Returns: 55
Let() for named variables in FileMaker calculationsCustom functions in FileMaker: when to create them and recursion
Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo