Expression is a user-defined function, which returns a value. Expressions allow to do dynamic calculations during report generation and to output the results of the calculations.

Report expressions are used in the following several cases:

- For grouping records (see report properties). Each time the result of the expression is changed, the current group ends and the new one begins. Grouping expressions are meaningful when at least one of the corresponding group bands is visible.
- In the
*Expression*objects, which can be placed into report template to show the result of expression in the prepared report. - In On Print property of report objects for calculating the objects' coordinates or global report variables.

Rules for writing expressions are similar to rules of Pascal programming language. Expressions are calculated using general rules for arithmetic, logical and string expressions.

Expressions can consist of:

- Constants (numeric, Boolean or string)
- Arithmetical operators, including MOD (returns the remainder obtained by dividing its operands) and DIV (integer division)
- Logical operators NOT, AND, OR, XOR, >, >=, <, <=, =, <>
- Field values
- SQL query parameter values (if the report dataset is a parameterized query)
- Functions
- Variables
- Comments (single-line text between a double-slash // and end of line, and any text between braces { and }).

For example, to include a field value, use *dataset_field_val* function. To include a SQL query parameter value, use *dataset_param_val* function.

There is an ability to use expressions with dynamic and static parts. Dynamic parts begin with three opening triangle brackets (<<<) and end with three closing triangle brackets (>>>). When expression contains dynamic parts, then only these parts will be parsed and calculated during the report generation, and other parts of the expression will be interpreted as constants and therefore will not be parsed. When expression does not contain dynamic parts, the report engine will try to parse the full expression. Using dynamic parts is shown in example 17.

It is possible to type expression directly or build it with expression builder (use "..." button for this), where you can select needed items like field names, functions etc. to add them in the expression. Once you have selected an item, click *Add* button. The resulting expression is shown in lower part of the window. You may edit it manually if it is needed. After you done, click *OK* to apply the expression to selected report object(s).

*to_string*or

*to_number*functions, as shown in example 10.

**See also**