Operators

Listed below are operators support by the Advantage application and can be used as part of the expression provided in the Validation field on the Configurable Validation table.

Operators

Description

Boolean and

 

Use && or the word and.

Examples:

COLUMN_1 == null and COLUMN_2 != null

COLUMN_1 == null && COLUMN_2 != null

Boolean or

Use || or the word or.

Examples:

COLUMN_1 == null or COLUMN_2 != null

COLUMN_1 == null || COLUMN_2 != null

Boolean not

Use ! or the word not.

Examples:

!(COLUM1_1 == null)

not (COLUMN_1 == null)

Bitwise and

Use & operator.

Example:

10 & 4

Bitwise or

 

Use | operator.

Example:

3 | 4

Bitwise xor

Use ^ operator.

Example:

33 ^ 44

Bitwise complement

Use ~ operator.

Example:

~33

Ternary conditional?:

Use standard JAVA style conditional operator condition? if_true : if_false.

Example:

val1 ? val1 : val2 and val1 ?: val2 are equivalent.

Note: The condition evaluates to false when the value referred is an undefined variable or null.

Equality

Use == or the abbreviation eq.

Examples:

COLUMN_1 == COLUMN_2

COLUMN_1 eq COLUMN_2

Note: Comparing null to any non-null value evaluates to false.

Inequality

 

Use != or the abbreviation ne.

Examples:

COLUMN_1 != COLUMN_2

COLUMN_1 ne COLUMN_2

Less Than

Use < or the abbreviation lt.

Examples:

COLUMN_1 < COLUMN_2

COLUMN_1 lt 10

Less Than Or Equal To

Use <= operator or the abbreviation le.

Examples:

COLUMN_1 <= COLUMN_2

COLUMN_1 le 10

Greater Than

Use > or the abbreviation gt.

Examples:

COLUMN_1 > COLUMN_2

COLUMN_1 gt 10

Greater Than Or Equal To

Use >= or the abbreviation ge.

Examples:

COLUMN_1 >= COLUMN_2

COLUMN_1 ge 10

In or Match=~

Use =~ operator to check that a string matches a regular expression. It also works like an “in” condition and checks if any collection contains a value or not.

Examples:

NAME =~ ‘.*\\d+.*’

TYPE =~ [ ‘MAX’,’MIN’, ‘AVG’]

Not-In or Not-Match!~

Use !~ operator to check that a string does not match a regular expression. It also works like “not in” condition and checks if any collection contains a value or not.

Examples:

NAME !~ ‘.*\\d+.*’

TYPE !~ [ ‘MAX’,’MIN’, ‘AVG’]

Starts With=^

Use =^ operator.

Example:

To match a Department code that starts with letter ‘C’

DEPT_CD =^ ‘C’

Not Starts With!^

Use !^ operator.

Example:

To match a Department code that does not starts with letter ‘C

DEPT_CD !^ ‘C’

Ends With =$

Use =$ operator.

Example:

To match a Department code that end with letter ‘C’

DEPT_CD =$ ‘C’

Not Ends With!$

Use !$ operator.

Example:

To match a Department code that does not end with letter ‘C’

DEPT_CD !$ ‘C’

Addition

Use +.

Example:

AMOUNT_1 + AMOUNT_2

Subtraction

 

Use -.

Example:

AMOUNT_1 - AMOUNT_2

Multiplication

Use *.

Examples:

AMOUNT_1 * AMOUNT_2

AMOUNT_1 * 10

Division

Use / or div.

Examples:

AMOUNT_1 / AMOUNT_2

AMOUNT_1 div 10

Modulus (or remainder)

Use % or mod.

Examples:

AMOUNT_1 mod 2

AMOUNT_1 % 2

Side-effect operators

The following side-effect forms supported.

  • +=

  • -=

  • *=

  • /=

  • %=

  • &=

  • |=

  • ^=

Negation

 

Use - operator.

Example:

AMOUNT_1 > -12

Array access

 

Use square brackets or a dotted numeral.

Example:

Refer to an item in a collection:

VALUES[0] or VALUES.0

Map access

Use square brackets.

Examples:

Refer to a map entry using index:

MAP_VALUES[0] or MAP_VALUES.0

Refer to a map entry using key:

MAP_VALUES[‘KEY’]