The Let Function and Variables

The Let function creates a temporary holder for a value, called a variable, which can be plugged into a calculation over and over again. You’ll do a little more work upfront to set up a variable, but that effort pays off with faster calculations that are easier to read, edit, and troubleshoot.

Defining Calculation Variables

In your Let function, you define a value and give it a name, and then use that name as often as you need throughout the calculation. In this case, you can calculate the amount due once, and store the result in a variable called Amount Due.

The Let function is unique among functions because it controls the way you write your calculation, not the result. Here’s an example:

	Let ( [ L = 5 ; W = 10 ; H = 3 ] ; L * W * H )

Like the Substitute function described on Other text parsing functions, Let uses bracketed notation. It really takes just two parameters. The first is a list of variable definitions. Each variable gets a name and a value using this format:

	Name = Value

Tip

FileMaker uses the terms “var” for Name and “expression” for Value in its manual and help files. The terms mean the same things, but “var” and “expression” sound much more impressive.

If you have more than one variable to define (as in the example above), put a semicolon between each one, and put them all between a pair of square brackets. You can use any calculation expression as the value.

In fact, the expression that determines the value of a variable can even use other ...

Get FileMaker Pro 9: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.