Filemaker Pro 8.5 Educational Maintenance T3 TJ083LL/A User Manual

Product codes
TJ083LL/A
Page of 238
130     FileMaker Functions Reference
Evaluate(GetField("textfield")) returns 
4
 when textfield contains 2 + 2.
Evaluate(TextField;[Amount]) returns 
.80
 when TextField contains .08 * Amount 
and the Amount field contains 10.00. 
Evaluate(“Let(TaxRate=.05;“& Tax Rate Calculation &“)”) returns 
.50
 
when the field Tax Rate Calculation contains SubTotal * TaxRate where SubTotal is a 
numeric field that contains 10.00.
The following example shows how to pass named parameters using the Evaluate, Let, 
and Get(ScriptParameter) functions, allowing access only to variable 'a' (the 
example returns 
6
):
ScriptParameter = "a = 5; b = 10"
Evaluate("Let ( [" & Get(ScriptParameter) & "]; a + 1 )")
The following example shows how to pass named parameters, allowing access to both 
variable 'a' and 'b'. The simplified first parameter makes the second parameter more 
complex (the example returns 
6,
 
12
):
ScriptParameter = "a = 5; b = 10"
Evaluate("Let ( [" & Get(ScriptParameter) & "]; a + 1 & \", \" & b 
+ 2 )")
The following example shows how to pass named parameters, while keeping the ability to 
check the syntax of the second parameter of the Let function (the example returns 
6,
 
12
):
ScriptParameter = "a = 5; b = 10"
Let(  [a = Evaluate("Let( [" & Get(ScriptParameter) & "]; a )"), 
b = Evaluate("Let( [" & Get(ScriptParameter) & "]; b )")]; 
a + 1 & ", " & b + 2 )
Note  
The Evaluate function evaluates an expression, including field values to be 
evaluated as a calculation formula. It also allows you to specify field dependencies so that 
a calculation using the evaluation function can be triggered due to changes in other fields 
of the same record. This function evaluates user-defined formulas. For example, you can 
create a formula in the Total field that computes state tax:
Evaluate(StateTaxFormula) + ShippingCost
where the StateTaxFormula field contains:
SubTotal * 1.0875
and the SubTotal field contains the subtotal before tax and shipping.
The Evaluate function has an optional second parameter, which is a field the calculation 
is dependent on. When the dependent field contents change, FileMaker Pro re-evaluates 
the calculation. In the following example, the Total calculation will be re-evaluated when 
SubTotal changes:
Evaluate(StateTaxFormula, SubTotal) + ShippingCost