Manipulating data types with casting operators
- Last Updated: March 24, 2021
- 1 minute read
- Corticon
- Version 7.2
- Documentation
A special set of operators is provided in the Corticon Studio's Operator Vocabulary that allows the rule modeler to control the data types of attributes and expressions. These casting operators are described below:
| Casting operator | Applies to data of type… | Produces data of type… |
|---|---|---|
.toInteger |
Decimal, String | Integer |
.toDecimal |
Integer, String | Decimal |
.toString |
Integer, Decimal, DateTime, Date, Time | String |
.toDateTime |
String, Date, Time | DateTime |
.toDate |
DateTime | Date |
.toTime |
DateTime | Time |
Returning to Datatype Mismatches in Comparision Expressions, we use these casting operators to correct some of the previous problems:
Casting operators were used in actions rules B and C to make the data types of the LHS and RHS match. Notice, however, that no casting operator exists to cast a Decimal into a Boolean data type for action E, hence the error.