Expressions Overview
- 3 minutes to read
Use expressions to accomplish the following tasks:
- Retrieve data
- Format data values
- Create calculated fields
- Calculate summaries
- Specify conditions for report elements
- Specify conditions for data source queries
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.
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.
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 allows you to use functions, operators, data source fields, report elements, constants, and variables to construct expressions.
The Expression Editor highlights an expression’s syntax and supports intelligent code completion (which suggests functions and available data elements as you type).
The Expression Editor displays all the errors it finds in the created expression.
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.
The FilterString Editor highlights an expression’s syntax and supports intelligent code completion (which suggests functions and available data elements as you type).
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.