syntax:operators
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
syntax:operators [2020/11/26 18:27] – dmitry | syntax:operators [2021/01/13 18:43] (current) – dmitry | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Operators ====== | ====== Operators ====== | ||
- | Here is list of operators that can be used in expressions in EasyMorph. | + | Here is a list of operators that can be used in expressions in EasyMorph. |
=== Basic operators === | === Basic operators === | ||
Line 38: | Line 38: | ||
IF // | IF // | ||
- | A shorter form where the ELSE expression is omitted and always returns an empty value, is also possible: | + | A shorter form where the ELSE expression is omitted and always returns an empty value is also possible: |
IF // | IF // | ||
- | Note that unlike the [[syntax: | + | Note that unlike the [[syntax: |
Examples: | Examples: | ||
Line 61: | Line 61: | ||
LET d = day(today()) | LET d = day(today()) | ||
IF d=1 THEN 'First day' ELSE 'Day: ' & d | IF d=1 THEN 'First day' ELSE 'Day: ' & d | ||
+ | |||
+ | === The ASSUME operator === | ||
+ | The operator allows creating guarding conditions that must evaluate to TRUE before the expression is evaluated. ASSUME can be used to ensure data quality and integrity right in expressions. The operator has the following syntax: | ||
+ | |||
+ | ASSUME // | ||
+ | |||
+ | ASSUME // | ||
+ | |||
+ | Examples: | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | In the expression above, the final statement will only be calculated if [Tax] is not negative. Otherwise, project execution will be aborted with a generic error. | ||
+ | |||
+ | It is also possible to specify a custom error message as follows: | ||
+ | |||
+ | | ||
+ | |||
+ | The OTHERWISE keyword is optional. It can be safely omitted: | ||
+ | |||
+ | | ||
+ | |||
+ | ASSUME can be used together with the other operators. For instance: | ||
+ | |||
+ | | ||
+ | LET tax = [Tax base] * {Tax Rate} - [Tax credit] | ||
+ | | ||
+ | | ||
+ | |||
+ |
syntax/operators.txt · Last modified: 2021/01/13 18:43 by dmitry