Domain Expression Language (DomEL)

A DomEL expression is a shorthand way of writing a complex query. Many components of a Domain need to compute values based on some expression involving constants, field values, and environment variables. The Domain Expression Language (DomEL) was created to fill this need. Currently, the following features in XML design files are expressed in DomEL:

The IN clause for custom joins
Calculated fields
Filter expressions in Domains and Domain topics (equivalent to where clauses)
Server attribute values (see Using Server Attributes in Design Files)
Row-level security (see Securing Data in a Domain)

When processing a report based on a Domain, the server interprets DomEL expressions to generate parts of the SQL expression that perform the desired query. Depending on the data policy, either the augmented SQL is passed to the data source, or the server performs a simpler query and applies the DomEL expressions to the full dataset in memory.

This chapter contains the following sections:

Datatypes
Field References
Operators and Functions
SQL Functions
The groovy() Function
Complex Expressions
Return Types

Datatypes

The following simple datatypes may be declared as constants, used in expressions, and returned as values:

Simple Type

Description

Example of Constant

boolean

Expressions such as comparison operators return boolean values, but true and false constants are undefined and cannot be used.

none

integer

Whole numbers.

123 or -123

decimal

Floating point numbers. Decimal separator must be a period (.); other separators such as comma (,) are not supported.

123.45 or -123.45

string

Character string entered with single quotes ('); double quotes (") are not supported.

'hello world'

date

ANSI standard date.

d'2009-03-31' or
Date('2009-03-31')

timestamp

ANSI standard date and time.

ts'2009-03-31 23:59:59' or
TimeStamp('2009-03-31 23:59:59')

The composite datatypes, shown in the following table, may be declared as constants and used with the in set or in range operator. The values in these composite types are not necessarily constant, they could be determined by field values.

Composite Type

Description

Example

set

Contains any number of any simple type above.

(1, 2, 3)('apples','oranges')

range

Inclusive range applicable to numbers and dates, including fields that are number or date types.

(0:12) or (0.0:12.34)(d'2009-01-01':d'2009-12-31')(limit_min:limit_max)