![]() |
Next Page |
| Contents > Functions reference (alphabetical list) > Logical functions > Let function |
|
|
| Let function |
| Format |
Let({[}var1=expression1{;var2=expression2...]};calculation) |
| Parameters |
| var - any variable name, local variable name, or global variable name (see About naming fields for guidelines on naming variables) |
| expression - any calculation expression, field, or constant |
| calculation - any calculation expression, field, or constant |
| Parameters in curly braces { } are optional. |
| Data type returned |
| text, number, date, time, timestamp, container |
| Description |
Let([variable=value;variable2=value2];calculation) |
| The $ symbol references a local variable and two $$ symbols reference a global variable. An optional repetition number appears in square brackets [ ] immediately after the variable name. For example: |
Let([$variable[repetition]=value;$$variable2=value2]{;calculation} ) |
| Examples |
| Let(x=5;x*x) returns 25. |
| Let([x=5;squared=x*x;cubed=squared*x];cubed) returns 125. |
| Let(City="Paris";Let(City="San Francisco";City&"-")&City) returns San Francisco - Paris. |
| The following example sets a local variable counter at repetition 50 with a value of 120: |
| Let($counter[50]=120;$counter[50]*2) returns 240. |
| 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" |
ScriptParameter = "a = 5; b = 10" |
| 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" |
| Related topics |
| Functions reference (category list) |
| Functions reference (alphabetical list) |
| About formulas |
| About functions |
| Defining calculation fields |
| Using operators in formulas |
| Using variables |
|
|
| Contents > Functions reference (alphabetical list) > Logical functions > Let function | Next Page |