Let() with multiple variable declarations
BeginnerMaster multi-variable Let() to write complex calculations as readable, step-by-step derivations where each variable builds on the previous.
What you'll learn
- How to declare multiple variables in a single Let()
- How later variables can reference earlier ones in the list
- How to stage a multi-step transformation using Let() variables
- How to name variables for maximum readability
Let() can declare any number of named variables in its first argument, and each variable can reference variables declared before it in the list. This transforms even the most tangled calculation into a sequence of named, comprehensible steps -- the same pattern used in functional programming languages. Mastering multi-variable Let() is the single biggest improvement most FileMaker developers can make to their calculation quality.
Multi-variable Let() syntax
Wrap multiple variable assignments in square brackets, separated by semicolons. Each assignment is name = expression.
Let ( [ fullName = Contacts::FirstName & " " & Contacts::LastName ; initials = Left ( Contacts::FirstName ; 1 ) & Left ( Contacts::LastName ; 1 ) ; displayName = If ( Length ( fullName ) > 30 ; initials ; fullName ) ] ; displayName )
Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo