Validation Expression Syntax
The Configurable Validation functionality implements the Apache JEXL expression evaluation library and expression syntax must comply with the JEXL rules. Though JEXL supports advanced dynamic scripting features, the following sections list basic operators, literals and special keywords supported by the Advantage application.
-
Literals
-
Operators
-
Functions
-
Keywords
Literals
Listed below are literals support by the Advantage application and can be used as part of the expression provided in the Validation field on the Configurable Validation table.
|
Item |
Description |
|---|---|
|
Array Literal |
Use square brackets with one or more values separated by a comma. Example: [ 1, 2, 3 ] Note: It is always recommended to use all the entries in the array of the same class for correct comparisons. |
|
Big Decimal Literals |
Use 1 or more digits from 0 to 9, followed by a decimal point and then one or more digits from 0 to 9 suffixed with b or B. Example: 442.0b 42.0B |
|
Big Integer Literals |
Use 1 or more digits from 0 to 9 suffixed with h or H. Examples: 42h or 42H |
|
Boolean Literals |
Use the word true or false. Examples: ACTIVE_FL == true or ACTIVE_FL == false |
|
Double Literals |
Use 1 or more digits from 0 to 9, followed by a decimal point and then one or more digits from 0 to 9 suffixed with d or D. Examples: 42.0d 42.0D |
|
Float Literals |
Use 1 or more digits from 0 to 9, followed by a decimal point and then one or more digits from 0 to 9, optionally followed by f or F. Examples: 42.0 42.0f |
|
Integer Literals |
Use 1 or more digits from 0 to 9. Examples: 42 100 |
|
Long Literals |
Use 1 or more digits from 0 to 9 suffixed with l or L. Examples: 42l 42L |
|
Map Literal |
Use curly brackets ({ }) with one or more sets of key: value pairs separated by a comma (,). Example: { "one" : 1, "two" : 2, "three" : 3, "more": 4 } Note: It is always recommended to use all the values in the map of the same class for correct comparisons. |
|
Null Literal |
Use the word null. Example: MY_COLUMN == null |
|
Real literals - exponent support |
Use standard Java exponent notation (that is, suffix the number with e or E followed by the sign + or - followed by one or more decimal digits). Examples: 42.0E-1D 42.0E+3B |
|
Set Literal |
Use curly brackets ({ }) with one or more values separated by a comma (,). Example: { "one" , “two”, "three"} Note: It is always recommended to use all the entries in the set of same class for correct comparisons. |
|
String Literals |
Use either the single quote (') or double quotes ("). For example: "Advantage" and 'Advantage' are equivalent. |
Operators
Listed below are operators supported by the Advantage application and can be used as part of the expression provided in the Validation field on the Configurable Validation (BORULE) table.
|
Operators |
Description |
|---|---|
|
Boolean and |
Use && or the word and. 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 the & operator. Example: 10 & 4 |
|
Bitwise or |
Use the | operator. Example: 3 | 4 |
|
Bitwise xor |
Use the ^ operator. Example: 33 ^ 44 |
|
Bitwise complement |
Use the ~ 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 the =~ 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 the !~ 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 the =^ operator. Example: To match a Department code that starts with letter ‘C’ DEPT_CD =^ ‘C’ |
|
Not Starts With!^ |
Use the !^ operator. Example: To match a Department code that does not starts with letter ‘C DEPT_CD !^ ‘C’ |
|
Ends With =$ |
Use the =$ operator. Example: To match a Department code that ends with letter ‘C’ DEPT_CD =$ ‘C’ |
|
Not Ends With!$ |
Use the !$ 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 are 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’] |
Functions
Listed below are the default functions supported by the Advantage application and can be used as part of the expression provided in the Validation field on the Configurable Validation (BORULE) table to facilitate readable expressions.
|
Functions |
Description |
|---|---|
|
empty |
Evaluates whether the argument passed is 'empty'. Returns true when the argument is:
Examples: empty(FUND_CD) !empty(TRANS_AMT) |
|
Size |
Evaluates the 'size' of the argument passed. This method returns:
Example: size(CODE) |
Keywords
Listed below are keywords supported by the Advantage application and can be used as part of the expression provided in the Validation field on the Configurable Validation (BORULE) table. Note: This section is not applicable to Performance Budgeting.
|
Keywords |
Description |
|---|---|
|
applicationDate |
Represents the date that the Advantage application is using. This is the date value configured on the Application Parameter (APPCTRL) table. For example, the following expression compares the effective date to the application date. EFFECTIVE_DT > applicationDate |
|
applicationDateTime |
Represents the date and time that the Advantage application is using. This is the date value configured on the Application Parameter table plus the server time value at the time the value is requested. For example, the following expression compares the Effective Date to the Application Date Time. UPDATE_DT > applicationDateTime |
|
systemDate |
Represents the Server Date on which the Advantage application is running. For example, the following expression compares the Batch End Date with the Server Date. BATCH_END_DT > systemDate |
|
systemDateTime |
Represents the Server Date Time on which the Advantage application is running. For example, the following expression compares the Batch End Date to the Server Date Time. BATCH_END_DT > systemDateTime |
|
systemTime |
Represents the current time. For example, the following expression compares the time to the server time. END_TM < systemTime |