Operators

Arithmetic operators

Concatenation operators

Logical and comparison operators

About operators

In DML expressions, you can use the following operators:

  • Arithmetic operators
  • Concatenation operators
  • Logical and comparison operators

These operators are evaluated in a specific order of priority.

Note: This topic does not describe how the operators handle the value null.

Arithmetic operators

Use the arithmetic operators to calculate values. The operands that you use (and also the target fields) must be from the Integer (N,S, or P) ) and Decimal Number (N, S or P) Data Class.

The following table summarizes the available arithmetic operators:

Operator Meaning

+

The plus sign adds two operands.

-

The minus sign subtracts one operand from another.

*

The asterisk character multiplies two operands.

/

The forward slash character divides one operand into another.

If you divide:

  • One Integer by another, processing truncates any decimal numbers from the result. If the result is less than 1, then 0 is returned.
  • Into a Decimal field, processing rounds off the result to the nearest integer.

//

the double slash character divides one operand into another and rounds off the result to the nearest integer

You can set the minus (-) sign at the beginning of the arithmetic expression to enter a negative expression in the resulting field. If the target field is N (unsigned numeric), the result of the operation is its absolute value.

The following table illustrates the use of arithmetic operators with some examples: 

Target field

Mapping Rule

MT_TTC

MT_HT (1 + TXPAYS)

MT_ASS I

 

IF TX_ASS <> 0 THEN MT_ASS1 + MT_ASS2 + MT_ASS3 +MT_ASS4 + MT_ASS5 ELSE $ACCTAB (ASSURANCE; CATPRET)

NBRNUM

(NB1 + NB4) * (NB5 - NB2) / (100 + NB5)

NB

NBA + NBB - NBC

AMOUNT

 IF CODEXT = "1" THEN - MT_CRE1 ELSE MT_CRE1

Concatenation operator

To concatenate two expressions, use the ampersand character (&). Since AccountingIntegrator Rule Engine can implicitly convert to the Data Class String, you can use some non-string characters with the concatenation operator. You can concatenate any of the following Data Classes (note that the Data class Decimal Number is not in the list) :

  • Date
  • Integer
  • String

For example, you can concatenate a String with a Date.

NOTE:The target field must contain an alphanumeric data type.

The following table illustrates the use of concatenation with some examples:

Target field Mapping Rule

ALPHAOEVT1

 

"AA1BB2CC5"&INEVTFIELD1ALPHAOVT1 is the result of the concatenation of the alphanumeric constant AA1BB2CC5 and the value of the INEVTFIELD1 field

ZONEINEVT3

"LABEL1" & FIELD5 & $ACCTAB(TABLEREF;FIELD5)ZONEINEVT3 is the result of the concatenation of the "LABEL1" alphanumeric description of the value of the FIELD5 segment field and the value of the entry associated with the value of FIELD5 in the TABLEREF table

Decimal numbers concatenation constraints are:

  • “178237483.822342” is allowed to be transferred to an alphanumeric field.
  • 178237483.822342 is not allowed to be transferred to an alphanumeric field.

Logical and comparison operators

In If_Then_Else instructions, use:

In the condition generation expressions you can also use logical expressions that return the values true or false. You can use these condition generation expressions in the following:

Comparing two expressions

The Data Classes of the expressions that you can compare are Integers.

The following table summarizes the operators that you can use to compare the values that are returned by two expressions:

Operator The comparison is true when:

>

the value on the left of this operator is greater than the value on the right

<

the value on the left of this operator is less than the value on the right

=

the values on both sides of this operator are equal

<>

the values on both sides of this operator are not equal to one another

>=

the value on the left of this operator is greater than or equal to the value on the right

<=

the value on the left of this operator is less than or equal to the value on the right

Combining the return values of comparison expressions

When you use the logical operators AND and OR, you must delimit each of the expressions with parentheses and place a space on each side of an operator as illustrated in this example:

  • AND operator: (EXPRESSION1) AND (EXPRESSION2)
  • OR operator: (EXPRESSION1) OR (EXPRESSION2)

The following table summarizes the operators that you can use to combine the return values of two expressions:

Operator Meaning

AND

Performs logical multiplication:

  • true when both expressions are true
  • false when one or both expressions are false

OR

Performs logical addition:

  • true when one or both of the expressions are true
  • false when both of the expressions are false

The following table illustrates the use of comparison expressions with some examples:

Target field Mapping Rule

ZONEINEVT

 

IF (CPT <> 963521) THEN ZONEINEVT&"956AAA" ELSE "963"&ZONEINEVT&"XXX"

RESULTOEVT

IF ((NOCPTE3 = 777) OR (CODOP < 125)) THEN (MT1 + MT2) / 2ELSE (MT2 + MT5 + MT6) / 3

Order of priority

In a Mapping Rule phrase, the relationship between the various functions is represented by separators, parentheses and spaces that specify the order in which the functions must be processed. AccountingIntegrator Rule Engine processes the expression from left to right, depending on:

  • the arrangement of the parentheses
  • followed by the arithmetic priority of the operators, as summarized in the following table
Order of Priority (1= highest) Operator / Character

1

+, - (plus and minus signs for Integers)

2

( ) (parentheses)

3

*, /

4

&

5

AND

6

OR

7

+, - (addition and subtraction operators)

8

=, <>

9

<, <=, >, >=

Back to top

Related Links