All docs
V21.2
21.2 (EAP/Beta)
21.1
20.2
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
You are viewing help content for pre-release software. This document and the features it describes are subject to change. Switch to the current version.

Expressions Overview

  • 4 minutes to read

Use expressions to accomplish the following tasks:

Watch Video: Expression Basics

How to Specify an Expression

In the Report Designer, properties that support expressions have an ellipsis button in the value editor. Click this button to invoke the Expression Editor.

property-editor-ellipsis-button

As an alternative, you can use the Properties window to specify an expression for a report, band, or control. The Properties window lists all properties that support expressions in a separate tab. Select a report, band, or control, and switch the Properties window to the Expressions tab to access these properties.

property-grid-expression-tab

In ExpressionsAdvanced mode, the Report Designer allows you to specify expressions that are evaluated within specific events:

  • The BeforePrint event where you can use data fields from all queries in the data source.
  • The PrintOnPage event fetches the number of pages in the report and the current page. You can use these variables to specify conditions for report items.

See the following topic for more information: Data Binding Modes.

At runtime, XtraReport, Band, and XRControl objects have a collection of expression bindings. Each element from this collection binds the object’s property with an expression that specifies the property’s value. Specify elements in this collection to bind the object’s properties to data.

Expression Editor

The Report Designer’s Expression Editor has a graphical interface that allows you to create and edit expressions.

Expression Editor

Use one of the following ways to invoke the Expression Editor:

  • Select a report, band, or control. The f button appears next to the selection. Click this button to invoke the Expression Editor.

    The f Button Near the Control

  • In the Properties window, if an expression can be set for a property, the f button appears near the value editor. Click (in the End-User Report Designer) or double-click (in the Visual Studio Report Designer) this button to invoke the Expression Editor.

    The f Button in the Properties Window

    The f button changes its color to blue to indicate that an expression is set for a property.

    The f Button Indicates that an Expression is Set

  • In the Visual Studio Report Designer, the Properties window has the Expressions tab that lists properties for which expressions can be set. An ellipsis button (...) appears in the value editor when you select a property. Click the ellipsis button to invoke the Expression Editor.

    An Ellipsis Button to Invoke the Expression Editor

The Editor lists all properties for which you can specify an expression. The list of properties is hidden when you specify a parameter or calculated field’s expression.

Click a property to specify an expression.

Properties List in the Expression Editor

An f icon appears next to a property where an expression is set. Additionally, an asterisk (*) appears if an expression is modified.

The Text Expression Is Modified

The Editor highlights an expression’s syntax and supports intelligent code completion (which suggests functions and available data elements as you type).

Intellisense in the Expression Editor

The Expression Editor displays all the errors it finds in the specified expression.

Expressions_ExpressionEditor_ErrorValidation

The Editor lists a tree with language elements and items that you can use in an expression.

Items to Use in Expressions

FilterString Editor

You can use the Report Designer’s FilterString Editor to specify the FilterString property of a report, XRCrossTab, or XRChart‘s Series.

The FilterString Editor‘s visual interface allows you to use an unlimited number of conditions and combine them with logical operators to create filter criteria. You can also switch to Text mode and type a filter string.

Expressions_FilterEditor

The FilterString Editor highlights an expression’s syntax and supports intelligent code completion (which suggests functions and available data elements as you type).

FilterEditor_New_Features

Expression Syntax

An expression can include field names, constants, operators, functions, data fields, and parameters.

See the following topic for more information: Expression Language.

Refer to the CustomFunctions class description for information on how to implement a custom expression function in your reporting application.