Understanding Simple and Complex Expressions (Reporting Services)
In Reporting Services, expressions are used throughout the report definition to specify or calculate values for parameters, queries, filters, report item properties, group and sort definitions, text box properties, bookmarks, document maps, dynamic page header and footer content, images, and dynamic data source definitions.
Expressions begin with an equal (=) and are written in Microsoft Visual Basic. Expressions can include a combination of constants, operators, and references to built-in values (fields, collections, and functions), and to external or custom code.
Expressions can be one of the following two types:
Simple An expression that is a single reference to an item in a built-in collection, such as, a dataset field, a parameter, or a built-in field. Simple expressions appear on the design surface and in dialog boxes in brackets, such as [FieldName], which represents the underlying expression =Fields!FieldName.Value. You can type simple expressions directly into a text box on the design surface and the corresponding expression text is set as the value of a placeholder inside the text box. For more information, see Formatting Text and Importing HTML.
Complex An expression that includes more than a simple reference. Complex expressions appear on the design surface as <<Expr>>. You can create complex expressions in the Expression dialog box or type them directly into the Property pane. For more information about what you can include in an expression, see Understanding Expression References (Reporting Services).
You set simple expressions automatically by dragging items such as dataset fields to the design surface. To set expressions manually, select an item on the design surface, and use shortcut menus and dialog boxes to set the properties of the item. When you see the (fx) button or the value <Expression> in a drop-down list, you know that you can set the property to an expression.
For more information, see Using Expressions (Reporting Services).
Simple expressions use symbols to indicate whether the reference is to a field, a parameter, a built-in collection, or the ReportItems collection. The following table shows examples of display and expression text.
Display text example
Expression text example
Literal characters used for display text
="Page " & Globals!PageNumber & " of " & Globals!TotalPages