Self-referencing calculations and recursion limit awareness
ExpertUnderstand how circular field dependencies arise in FileMaker, how the engine handles them, and the recursion depth limit that applies to custom function recursion.
What you'll learn
- How FileMaker handles a direct circular reference in a calculation
- How self-joins enable legitimate self-referencing lookups
- How indirect circular dependencies through relationships arise
- The recursion depth limit for custom functions and how to stay safe
A self-referencing calculation is one that references its own table occurrence -- or, more dangerously, a field that eventually references back to itself, creating a circular dependency. FileMaker detects direct circular references and refuses to evaluate them. Indirect cycles through relationships are more subtle and can produce unexpected results or unexpected staleness.
Direct self-reference: what FileMaker does
If a Calculation field references itself, FileMaker detects the circular dependency and evaluates the field as empty (or returns the previous stored value for stored fields). It does not loop infinitely.
// This is a circular dependency -- FileMaker blocks it: // Field: Invoices::RunningTotal (Calculation) // Formula: RunningTotal + Amount // Result: FileMaker detects the cycle and returns empty or the previous stored value // Legitimate self-reference requires GetNthRecord() -- not a direct field reference: // RunningTotal = GetNthRecord(RunningTotal; Get(RecordNumber)-1) + Amount
Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo