Every expression has a Type, which Pega Platform deduces from the structure of the expression and the data types of the constants, functions, and clipboard properties mentioned in the expression.
You can enter a valid expression in a context for which the Type is not appropriate. For example, if you enter an expression in a when condition rule that is not of type True or False
, then Pega Platform reports an error when you try to save the rule.
In many situations, Pega Platform automatically converts the type of the expression to a type acceptable for the context. (In many programming languages such conversions are known as casting or typecasting.)
Pega Platform automatically performs the conversions when evaluating expressions and making assignments (such as to a target property in the Property-Set method):
To type |
|
|
|
|
|
|
|
Other ( |
From type |
||||||||
|
D |
D |
V |
V |
V |
C |
||
|
V, 2 |
V, 5 |
V, 5 |
V, 5 |
C |
|||
|
VN 3 |
V, 4 |
V, 4 |
C |
||||
|
V, 1 |
V, 5 |
V, 3 |
V |
V |
6 |
C |
|
|
V, 1 |
V, 5 |
V, 4 |
N |
V |
6 |
C |
|
|
V, 1 |
V, 5 |
V, 4 |
N |
V |
6 |
C |
|
|
C |
|||||||
Other |
S |
S |
S |
S |
S |
S |
S |
Entries in this table indicate whether and how automatic conversion occurs:
Entry |
Description |
No conversion necessary |
|
Conversion is not permitted. |
|
C |
Copies the value without examining whether it is valid. |
S |
Copies the value with no changes, then tests the result. If the value is not suitable for the target type, marks the property with the You can test this attribute through these three Public API methods in the ClipboardProperty interface:
|
D |
Date narrowing conversion, the appropriate subfield is selected and used Results of this conversion are correct only for the London time zone. See Understanding the Date, Time, and DateTime property types for an alternative approach that is often preferable. |
N |
Numeric narrowing conversion, the fractional portion is rounded. |
V |
Uses a preferred numeric conversion ( |
1 |
Conversion of a numeric type to |
2 |
Conversion of |
3 |
|
4 |
|
5 |
Numeric types converted to For example, the integer value 0 is converted into the Date value 19700101. |
6 |
When converting a number to |
The TextEncrypted
type, not shown in the table above, usually holds an encrypted text value. No automatic conversions occur for assignments to or from TextEncrypted
type. See Property form — Implementing and using the TextEncrypted Type.