Template syntax | Fields

<< Click to display table of contents >>

Template syntax | Fields

Fields are inserted in text of template documents. There is a limitation: the whole item text must be written using the same font and color (i.e., it must belong to a single TRichView text item).

Syntax definitions

::= means "defined as"

[x] means that x is optional

x | y means "either x or y"

x+ means x repeated 1 or more times.

<x> means that x is a term (that will be defined later)

x means 'x' or 'X' character (field text is case insensitive, unless explicitly specified otherwise)

Field syntax

<field> ::= {<data field> | <variable> | <command> | <cross-tab header> | <aggregate function> | <expression> }

Data fields

<data field> ::= <full data field name>[ <field type>][ "<format>"]

Variables

<variable> ::= %<variable name>[ <variable type>][ "<format>"]

Commands

<command> ::= $<command name>[ <command parameter>]

<command name> ::= if | ifdef | ifndef | else | endif | listreset | set | header | footer

Cross-tab header fields

<cross-tab header> ::= #<cross-tab field>[ <field type>][ "<format>"]

Aggregate functions

<aggregate function> ::= <function name>( ["]<param>["] )[ <field type>][ "<format>"]

Expressions

<expression> ::= =<expression text>[ <result type>][ "<format>"]

Special characters in text

A template text may contain '{' characters that should not be treated as a field start.

If this character does not has '}' after it in the same text item (i.e. in a text fragment written using the same font and color, not containing non-text items, tab characters and paragraph breaks), it is not treated as a field start. Otherwise, to insert '{' in text, use '{{'.

Example:

The text in a template:

The template may contain {{$IF} commands

produces in the final document:

The template may contain {$IF} commands

Fields in text strings

In addition to normal text, fields can be inserted in:

data queries of table rules and cells (for example, to implement master-detail or grouped queries);

hints (tool tips) of items;

hints of table cells;

tags of items (usually used as hyperlink targets);

names and tags of checkpoints (used to mark the position in a document).

There are the following differences for fields in these places:

commands are not supported;

all values are inserted as strings (if a data field cannot be represented as a string, the field is erroneous).