How to: Add an Expression (Reporting Services)
Expressions are used throughout a report for defining report item properties, filters, groups, sort order, connection strings, and parameter values. Expressions begin with an equal sign (=) and are written in Microsoft Visual Basic. They are evaluated at run time by the report processor, which combines the evaluation result with report layout elements.
Expressions can be simple or complex. Simple expression refer to a single item in a built-in collection. Complex expressions can contain constants, operators, global collection items, and function calls. For more information, see Understanding Simple and Complex Expressions (Reporting Services).
To enter a simple expression, type it directly into a text box on the design surface. The actual underlying expression is created for you. For example, if you type [FieldName] in a text box, the Value property for the text box is set to =Fields!FieldName.Value.
To enter a complex expression, use the Expression dialog box. Open the Expression dialog box by clicking the (fx) button in dialog boxes, or choosing Expression from shortcut menus.
To add an expression to a text box
In Design view, click the text box on the design surface to which you want to add an expression.
For a simple expression, type the display text for the expression in the text box. For example, for the dataset field Sales, type [Sales].
For a complex expression, right-click the text box, and select Expression. The Expression dialog box opens. Type or interactively create your expression after the '=' in the expression pane, and then click OK.
The expression appears on the design surface as <<Expr>>.
See Also