Share via


Expression Dialog Box (Report Builder)

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.

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. For more information, see Expression Examples (Report Builder and SSRS), Expressions (Report Builder and SSRS)

Expression Constructs

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.

Constants
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 Built-in Collections in Expressions (Report Builder and SSRS).

Parameters
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.

Datasets
Provides a list of available datasets and shows the fields that are members of the dataset.

Variables
Displays a list of report variables. For more information, see Report and Group Variables Collections References (Report Builder and SSRS).

Operators
Displays the operators you can include in a calculation or string manipulation. For more information, see Operators in Expressions (Report Builder and SSRS).

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 Custom Code and Assembly References in Expressions in Report Designer (SSRS).

Options

Code window
Use the code window in the top pane to type an expression. When you open the Expression dialog box, the code window contains the expression. You can replace or revise the expression. You can add function calls, operators, constants, fields, parameters, items from the global collections, and references to custom code. The code window displays your changes as you make them.

A wavy red underline indicates a syntax error. Hover over the underlined text to see the error message.

When you type in global collection terms followed by a punctuation separator, you will see a drop-down list of available members or properties. From the drop-down list, you can type the first few characters followed by a tab to automatically fill the selection.

When you type in a function name followed by a left parenthesis, you will see a tooltip that provides information about the parameters and function return values.

Category
Displays categories of expressions. Choosing a category establishes a context for creating an expression and changes the list of valid values in the Item pane. For example, for an expression for a text box value, expand Common functions and select Aggregate functions to display Avg, Count, and other functions in the Item pane.

Item
Displays the list of valid values for the selected category. Double-click on an item to add the expression text for this item at the insertion point in the code window.

Values
Depending on the category and item you select, the third pane contains a description, a sample expression, or a list of valid values. Drag the edge of the dialog box to widen the sample area.

See Also

Expressions (Report Builder and SSRS)
Formatting Report Items (Report Builder and SSRS)
Formatting Numbers and Dates (Report Builder and SSRS)
Parameters Collection References (Report Builder and SSRS)
Group Expression Examples (Report Builder and SSRS)
Filter Equation Examples (Report Builder and SSRS)
Dataset Fields Collection References (Report Builder and SSRS)
Aggregate Functions Reference (Report Builder and SSRS)
Data Types in Expressions (Report Builder and SSRS)
Select Color Dialog Box (Report Builder and SSRS)