Use the Expression dialog box to write Microsoft Visual Basic expressions for report item properties. You can use expressions to set many properties, including color, font, and borders. At run time, the report processor evaluates expressions and substitutes the result for the value of the property.
Expressions can be simple or complex. You can type simple expressions directly in a text box on the design surface or in a dialog box. To create complex expressions, use the Expression dialog box. For more information, see Understanding Simple and Complex Expressions (Report Builder 2.0).
To open the Expression dialog box, click the Expression (fx) button in dialog boxes, or select Expression from the shortcut menu or drop-down lists in the Properties pane. For more information, see Understanding Simple and Complex Expressions (Report Builder 2.0).
Some dialog boxes (for example, Dataset Properties Dialog Box, Filters (Report Builder 2.0)) allow you to create multiple expressions that are combined during report processing, but the Expression dialog box works with a single expression at a time.
The Expression dialog box includes a code window, category tree, category items, description pane, and example pane.
The Expression dialog box is context-sensitive; the category items and descriptions change in response to the expression category you are working with. It supports IntelliSense, statement completions, function call examples, and syntax coloring to help you detect syntax errors.
For more information, see How to: Add an Expression (Report Builder 2.0), Expression Examples (Report Builder 2.0), and Using Parameters Collection References in Expressions (Report Builder 2.0).
Expressions begin with an equal sign (=) and can include constants, literals, operators, and references to built-in fields, built-in collections, built-in functions, Visual Basic run-time library functions, .NET Framework common language runtime classes, and custom functions. The following list describes the categories and values you can add to an expression.
- Set expression for: <PropertyName>
The name of the property that you are defining an expression for. You can also set this property, by name, in the Properties pane.
Provides a list of predefined values valid for this property for properties that are based on constants. For example, a property based on color shows valid color names. For a property that is a Boolean data type, values are True and False.
Not all items that support expressions can be set to a constant. If a property cannot be set to constant value, the description pane provides this information.
- Built-in Fields
Provides a list of the items in the global collection that you can use in an expression. Some collections are only supported after the report is published to the server. For more information, see Using Built-in Collections in Expressions (Report Builder 2.0).
Provides a list of report parameters.
- Fields(<selected Dataset>)
Displays the list of fields for the dataset selected in the Datasets category. Double-click a field to copy the field to the Expression box.
Provides a list of available datasets and shows the fields that are members of the dataset.
Displays a list of report variables. For more information, see Using Report and Group Variables Collections References in Expressions (Report Builder 2.0).
Displays the operators you can include in a calculation or string manipulation. For more information, see Using Operators in Expressions (Report Builder 2.0).
- Common Functions
Displays common functions, grouped by type. When you select a function in the Item pane, a description and example appear.
Common functions include built-in report and aggregate functions, Visual Basic run-time library functions, and .NET Framework common language runtime classes (CLR) in the Math and Convert namespace. You can also add references to CLR classes and external assemblies that do not appear in the category list. For more information, see Using Common Function and Assembly References (Report Builder 2.0).