Database Reference
In-Depth Information
Defining Calculation Variables
In a Let() function, you define a value, 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
then store the result in a variable called AmountDue .
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 Text Editing 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
If you have more than one variable to define (as in the example above), put a semicolon
between each one and then 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 variables
defined earlier. For example, the next calculation is perfectly legal. Its Hours variable has a
value of 240 : 24 times the value of the Days variable:
Let (
[ Days = 10 ;
Hours = 24 * Days ;
Minutes = 60 * Hours ];
Minutes & " Minutes"
)
The second parameter can be any calculation expression. This parameter is special because
you can use any of the variables you've defined inside the expression, just like fields. The
first example above has three defined variables ( L, W , and H ); the expression then multiplies
them together.
When FileMaker evaluates the Let() function, it determines the value of each variable just
once and then plugs this value into the expression every time that variable is used. The result
of a Let() function is simply the result of its expression.
Total Due Calculation #3: Using the Let() Function
Your Total Due calculation can use the Let() function to solve all its problems. Just put the
Amount Due in a variable, and use it throughout the calculation:
Search WWH ::




Custom Search