![]() |
Next Page |
| Contents > Functions reference (alphabetical list) > Logical functions > Evaluate function |
|
|
| Evaluate function |
| Format |
Evaluate(expression{;[field1;field2;field3;...]}) |
| Parameters |
| expression - any text expression or text field. |
| fields - a list of fields that this function is dependent on. When these fields are modified, the calculation will update its result. |
| Parameters in curly braces { } are optional. Notice that the optional field list is enclosed in square brackets [ ]. |
| Data type returned |
| text, number, date, time, timestamp, container |
| Description |
| Evaluates expression as a calculation. |
| The optional fields parameter is a list of fields this calculation is dependent on. If a necessary field isn't listed, modifying that dependent field won't update the result of the calculation. |
| Examples |
| Evaluate(TextField) returns 4 when TextField contains 2 + 2. |
| Evaluate("textfield") returns 2 + 2 when textfield contains 2 + 2. |
| 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 )") |
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 )"), |
| Evaluate(StateTaxFormula) + ShippingCost |
| where the StateTaxFormula field contains: |
| SubTotal * 1.0875 |
| and the SubTotal field contains the subtotal before tax and shipping. |
| Evaluate(StateTaxFormula, SubTotal) + ShippingCost |
| The dependent parameter can also be useful in other cases. For example, |
| Evaluate("Get(CurrentTimeStamp)", [FieldB, FieldC]) |
| will store a timestamp in the calculation field whenever FieldB or FieldC changes. |
| Related topics |
| Functions reference (category list) |
| Functions reference (alphabetical list) |
| About formulas |
| About functions |
| Defining calculation fields |
| Using operators in formulas |
|
|
| Contents > Functions reference (alphabetical list) > Logical functions > Evaluate function | Next Page |