The template expression language
The following features and operators are supported:
- numeric literals, string literals (double-quote syntax only), Boolean literals (
- variable reference (see the list of defined variables later in this section)
- field reference (the "dot" operator)
- unary operators: +, -, ~, !
- binary operators: +, -, *, /, %, &, |, ^, &&, ||, <, <=, >, >=, ==, !=, <<, >>
- conditional operator: ?:
- parentheses: ()
"abc".length would trigger an error, instead of yielding the value 3.
The only objects available are those defined by the expression object model. The following variables are defined:
Contains the document-level template data with a field for each parameter in the template.
Only defined for expressions which appear inside a repeating region. Provides built-in information about the region:
_index The numerical index (from 0) of the current entry
_numRows The total number of entries in this repeating region
_isFirst True if the current entry is the first entry in its repeating region
_isLast True if the current entry is the last entry in its repeating region
_repeat object for the previous entry. It is an error to access this property for the first entry in the region.
_repeat object for the next entry. It is an error to access this property for the last entry in the region.
_parent In a nested repeated region, this gives the _repeat object for the enclosing (outer) repeated region. It is an error to access this property outside of a nested repeated region.
During expression evaluation, all fields of the _document object and _repeat object are implicitly available. For example, you can enter
title instead of
_document.title to access the documents title parameter.
In cases where there is a field conflict, fields of the _repeat object take precedence over fields of the _document object. Therefore, you shouldnt need to explicitly reference _document or _repeat except that _document might be needed inside a repeat region to reference document parameters that are hidden by repeated region parameters.
When nested repeated regions are used, only fields of the innermost repeated regions are available implicitly. Outer regions must be explicitly referenced using _parent.