and(left Boolean, right Boolean) Boolean
Clinical Decision Support Work Group | Maturity Level: 4 | Ballot Status: STU 2.1 |
This appendix provides a reference for all the system-defined types, operators, and functions that can be used within CQL. It is intended to provide complete semantics for each available type and operator as a companion to the Author’s and Developer’s Guides. The reference is organized by operator category.
For each type, the definition and semantics are provided. Note that because CQL does not define a type declaration syntax, the definitions are expressed in a pseudo-syntax.
For each operator or function, the signature, semantics, and usually an example are provided. Note that for built-in operators, the signature is expressed in a pseudo-syntax intended to clearly define the operator and its parameters. Although the symbolic operators may in general be prefix, infix, or postfix operators, the signatures for each operator are defined using function definition syntax for consistency and ease of representation. For example, the signature for the and operator is given as:
and(left Boolean, right Boolean) Boolean
Even though and is an infix operator and would be invoked as in the following expression:
InDemographic and NeedsScreening
Definition:
simple type Any
Description:
The Any type is the maximal supertype in the CQL type system, meaning that all types derive from Any, including list, interval, and structured types. In addition, the type of a null result is Any.
Definition:
simple type Boolean
Description:
The Boolean type represents the logical boolean values true and false. The result of logical operations within CQL use the Boolean type, and constructs within the language that expect a conditional result, such as a where clause or conditional expression, expect results of the Boolean type.
Definition:
structured type Code
{
code String,
display String,
system String,
version String
}
Description:
The Code type represents single terminology codes within CQL.
Definition:
structured type Concept
{
codes List<Code>,
display String
}
Description:
The Concept type represents a single terminological concept within CQL.
Definition:
simple type DateTime
Description:
The DateTime type represents date and time values with potential uncertainty within CQL.
CQL supports date and time values in the range @0001-01-01T00:00:00.0 to @9999-12-31T23:59:59.999 with a 1 millisecond step size.
Definition:
simple type Decimal
Description:
The Decimal type represents real values within CQL.
CQL supports decimal values in the range -1028-10-8 to 1028-10-8 with a step size of 10-8.
Definition:
simple type Integer
Description:
The Integer type represents whole number values within CQL.
CQL supports integer values in the range -231 to 231-1 with a step size of 1.
Definition:
structured type Quantity
{
value Decimal
unit String
}
Description:
The Quantity type represents quantities with a specified unit within CQL.
Definition:
simple type String
Description:
The String type represents string values within CQL.
CQL supports string values up to 231-1 characters in length.
For string literals, CQL uses standard escape sequences: