Condition block

The condition expression (CONDITION_EXPR) is an expression that evaluates to a Boolean value:

  • Operands can be literals (constants), variables and properties.
  • Operators are logical or relational.

Relational operators are the following.

Operator Description Operand type
= Operands are equal. String, Number, Boolean, Date
<> Operands are not equal. String, Number, Boolean, Date
<, >, <=,>= First operand is less than/greater than/less than or equal to/greater than or equal to the second operand. String, Number, Date
IS NULL True if the operand is null. The operator is unary and the operand precedes the operator. Any
IS NOT NULL True if the operand is not null. The operator is unary and the operand precedes the operator. Any
STARTS WITH First operand starts with a sub-string equal to second operand. String
CONTAINS First operand contains a sub string equal to second operand. String
ENDS WITH The first operand ends with a sub- string equal to second operand. String
IN

True if the first operand is in the specified list.

False otherwise.

First operand is String, Number or Date.

Second operand is a set of string literals that have to evaluate to the same type as the first operand.

NOT IN

True if the first operand is not found in the specified list.

False otherwise

First operand is String, Number or Date.

Second operand is a set of string literals that have to evaluate to the same type as the first operand.

Syntax notation for IN and NOT IN

[NOT] IN { EXPRESSION [, EXPRESSION ]* }

Examples

myV1 IN {“EUR”, “USD”, “CHF”} // is equivalent to: myV1 = “EUR” OR myV1 = “USD” OR myV1 = “CHF”

myV2 NOT IN {“EUR”, “USD”} // is equivalent to: myV2 <> “EUR” AND myV2 <> “USD”

definition
v1: number
if obj code in (1, 2, v1, v1 * 2) then obj.p1 = 0

The logical operators only admit Boolean operands. In the following table, operators are sorted according to their precedence (highest comes first).

NOT Logical negation. Unary operator; the operand follows the operator.
AND Logical “and” (true if both operands are true, false otherwise)
OR Logical “or” (false is both operands are false, true otherwise)

Examples

IF obj.PROP1 IS NOT NULL AND

(

obj.PROP1 IN {“EUR”, “CHF”} OR

obj.PROP1 STARTS WITH “X”

)

THEN

obj.PROP2 = “X”

The condition expression can span multiple lines the same way as the variable initialization expression.

Related Links