Working with Report Expressions

Expressions are widely used throughout a report definition to retrieve, calculate, display, group, sort, filter, parameterize, and format the data in a report. Because many report item properties can be set to an expression, you have great flexibility to control the content, design, and interactive nature of your report by using expressions. Expressions are written in Visual Basic, saved in the report definition, and evaluated by the report processor when you run the report.

On the report design surface, expressions appear as simple or complex expressions. Simple expressions contain a reference to a single dataset field, parameter, or built-in field. Simple expressions appear on the design surface and in dialog boxes in brackets; for example, a dataset field appears as [ProductID]. Simple expressions are created for you automatically (for example, when you drag a field from a dataset onto a text box), or you can type them directly into a data region cell, or text box on the design surface or in a dialog box. Complex expressions can contain multiple built-in references, operators, and function calls, and appear on the design surface as <<Expr>>. To see or change the expression text, you must open the Expression dialog box.

To see evaluated expression values in a report, preview the report. When the report runs, the report processor evaluates the expressions and substitutes the expression results for the property values.

Parameters can be used with expressions to provide additional flexibility for changing the content and appearance of a report. For more information, see Adding Parameters to Your Report.

In This Section