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 intersection of the row for A's type and the column for B's type. Consult the numbered notes for the details of casting or conversion.
DateTime
|
Date
|
Time of Day
|
Integer
|
Decimal
|
Double
|
True or False
|
Other (text) | |
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 Platform reports an error.
-
For
+
, performs Java String concatenation (result is of modeSingle Value
). The minus operator (-
) is not permitted. -
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.) -
The
+
operator is not permitted. The-
operator converts operands toDecimal
and performs the operation, yieldingDecimal
number of days and fraction of day. -
The
+
operator converts operands toDecimal
and performs the operation, yielding aDateTime
with GMT assumed. The - operator is not permitted. -
Converts operands to
Decimal
and performs the operation, yielding aDate
(rounded),Time of Day
orDateTime
(depending upon type of original non-numeric operand)