You are here: Record management > Building expressions with the Expression Builder > Expression evaluation > Add and subtract operations

Add and subtract operations

This table shows the valid combinations of types when the operator is + or -. To understand the calculation of the expression A + B, find the type of A in the Left Hand Side (rows) of each table. Find the type of B in the Right Hand Side (columns) if the table. Consult the numbered notes for the details of casting or conversion.

Right Hand Side

DateTime

Date

Time of Day

Integer

Decimal

Double

True or False

Other (text)

Left Hand Side

DateTime

3

3

3

5

5

5

X

1

Date

X

3

4

5

5

5

X

1

Time of Day

X

4

3

X

5

5

X

1

Integer

5

5

X

2

2

2

X

1

Decimal

5

5

5

2

2

2

X

1

Double

5

5

5

2

2

2

X

1

True or False

X

X

X

X

X

X

X

1

Other (text)

1

1

1

1

1

1

1

1

X indicates that a casting, promotion or conversion is not supported. The Pega 7 Platform reports an error.

  1. For +, performs Java String concatenation (result is of mode Single Value). The minus operator (-) is not permitted.
  2. Converts Integer > Double > Decimal until both operands have same type, then perform operation. Result is of the promoted type. (Converts directly to the target type without performing intermediate conversions.)
  3. The + operator is not permitted. The - operator converts operands to Decimal and performs the operation, yielding Decimal number of days and fraction of day.
  4. The + operator converts operands to Decimal and performs the operation, yielding a DateTime with GMT assumed. The - operator is not permitted.
  5. Converts operands to Decimal and performs the operation, yielding a Date (rounded), Time of Day or DateTime (depending upon type of original non-numeric operand)