Creating Expressions in Reporting Services

New: 5 December 2005

In Reporting Services, an expression describes data or property values. Expressions are used to control the content and the appearance of a report.

An expression begins with an equal sign (=) followed by a combination of field identifiers, constants, functions, and operators. An expression is evaluated by the report processor and yields a single data value that replaces the expression.

How to Create Expressions

You can create expressions in a report definition through the Edit Expression dialog box or by typing expression syntax directly into a text box, a Properties window property value field, or a group or sort expression field. The Edit Expression dialog box gives you context-sensitive global collection item choices, statement completion, syntax checking, and a larger work area. The following figure shows the Edit Expression dialog box.

Edit expression dialog box to enter expressions

From many property text boxes or dialog box fields, you can select <Expression> from the drop-down list, shown in the following figure.

Textbox property dropdown, choose Expression

You can right-click text boxes and other report items to display a shortcut menu and then click Expression, shown in the following figure.

Right-click context menu, choose Expression

On some dialog boxes, the fx button is available for setting a property value. For example, on the report item Table Properties dialog box, on the General tab, the fx button is available to set ToolTips.

For more information about the Edit Expression dialog box, see How to: Add an Expression (Report Designer) and Edit Expression (Report Designer).

Valid Expression References

The following table shows the types of references that you can include in a report expression. The table indicates which of these references are built-in, and which references you must identify to the report processor so that the function calls can be resolved during report processing.

Items Description of functions and how to reference them

Reporting Functions

Built-in. Functions that provide aggregate values on report items, and other utility functions that support aggregation. The Aggregate implementation is supplied by each data provider. For more information, see Using Report Functions in Expressions (Reporting Services).

Reporting Collections

Built-in. Globals, User, Parameters, Fields, ReportItems, Datasources, Datasets. For more information, see Using Global Collections in Expressions (Reporting Services).

Visual Basic Run-time Library

Built-in. For more information, see "Visual Basic Run-Time Library Members" at msdn.microsoft.com.

System.Math

Built-in. For more information, see Math.

System.Convert

Built-in. For more information, see Convert.

Custom Code

Built-in. Add your Visual Basic code through the Report Properties menu, Code tab. You can define public constants, variables, subroutines, and functions for your use in each report definition. For more information, see Using Custom Code References in Expressions (Reporting Services).

.NET Framework (common language runtime) Classes

Add fully qualified references in your expression. For example, System.Text.StringBuilder.

Custom Assemblies

Other .NET Framework Assemblies

Other External Assemblies

Add references in the Report Properties menu, References tab, under References section. For more information, see Using Custom Assemblies with Reports and Report Properties (References Tab, Report Designer).

Custom Class Instances

Add references to Report Properties menu, References tab, under Classes section. For more information, see Using Custom Code References in Expressions (Reporting Services) and Report Properties (References Tab, Report Designer).

For examples, see Expression Examples in Reporting Services.

See Also

Other Resources

Using Expressions in Reporting Services

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

14 April 2006

New content:
  • Expanded description of custom code.