Basic data types
- Last Updated: June 19, 2023
- 1 minute read
- Corticon.js
- Documentation
The proper expression and execution of rules in Corticon rules is dependent on the type of data involved. Each attribute in the Corticon Vocabulary has a data type, meaning that it has restrictions on the type of data it can contain. Corticon standard data types are as follows:
| Data Type | Description |
|---|---|
| String | Any combination of alphanumeric characters, of any length. |
| Integer | A whole number, including zero and negative numbers, to the maximum values for a 64-bit long signed integer with 53 significant digits (-9007199254740991 to 9007199254740991). |
| Decimal | A number containing a decimal point, including zero and negative numbers to the limits of precision in our library. With an arbitrary-precision, the Decimal type for JavaScript calculations are slower than with a plain Number, but they can be executed with an arbitrary higher precision that reduces occurrence of round-off errors. Decimal values in JSON input payloads can be represented either as a number or as string. See below for details and examples. |
| Boolean | Values are true and
false. T and F can also be
used. |
| DateTime | DateTime values in a Corticon.js
payload must conform to the ISO 8601 standard, or as the number of
milliseconds since the epoch. For example, for |
| Date | A value with only date information. No time information is allowed. |
In this guide, the data types Integer and Decimal are often referred
to by the generic term <Number>. Wherever
<Number> is used, either Integer or Decimal
data types may be used.
Decimal data in payloads
Decimal data might not fit in a JavaScript number type because JavaScript numbers are a subset of all numbers that can be expressed with the Decimal data type. Therefore, decimals as JavaScript numbers in JSON payload are represented as Strings. For example:
Decimal format in JSON Input Payload
Decimals in a JSON input payload can be represented either as a number or as string. For example:
|
Decimal format in JSON Output Payload
Decimals as JavaScript numbers in a JSON output payload are converted to Strings (stringified). For example:
|