About EasyMorph Tutorials & Examples Web-help

💡 Annoucement: the ASSUME operator

In version 4.6.1, we’ve introduced 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, without creating the “Halt on condition” action. The operator has the following syntax:

ASSUME expression

ASSUME expression OTHERWISE FAIL expression


ASSUME [Tax]>=0
[Amount] + [Tax]

In the 2-line 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:

ASSUME [Tax]>=0 OTHERWISE FAIL "Tax must not be negative"

The OTHERWISE keyword is optional. It can be safely omitted:

ASSUME [Tax]>=0 FAIL "Tax must not be negative"

ASSUME can be used together with the other operators. For instance:

ASSUME isnumber({Tax Rate}) OTHERWISE FAIL ("Invalid tax rate: " & {Tax Rate}) 
LET tax = [Tax base] * {Tax Rate} - [Tax credit] 
ASSUME tax >= 0 OTHERWISE FAIL "Tax must not be negative" 
[Amount] + tax
To learn more about EasyMorph visit easymorph.com.