Export (0) Print
Expand All

Understanding Expression References (Report Builder 2.0)

SQL Server 2008

When you write an expression in Reporting Services, you have access to many built-in fields, built-in collections, and functions that you can use alone or combine with other terms. When you create an expression interactively in the Expression dialog box, you can explore the categories of references that you can include, and see context-sensitive examples of constants, built-in collections, and functions available for including in your expressions. For examples of where you can use expressions, see Using Expressions (Report Builder 2.0) and Expression Examples (Report Builder 2.0).

You can add function calls, operators, constants, fields, parameters, items from the built-in collections, and references to embedded custom code or custom assemblies. Built-in function calls include aggregation and report calculations, the Visual Basic run-time library, and .NET Framework common language runtime (CLR) classes for Math and Convert. You can also include references to other .NET Framework classes and external assemblies.

When you create an expression for a specific report item property, the types of references you can include depend on the values that the property can accept. For example, if you create an expression for the value for a Font property, the value must evaluate to the name of a font.

The following table shows the kinds of references you can include in an expression.

References

Description

Example

Constants

Describes the constants you can access interactively for properties that require constant values, for example, font colors.

="Blue"

Operators

Describes the operators you can use to combine references in an expression, for example, the & operator is used for concatenating strings.

="The report ran at: " & Globals!ExecutionTime & "."

Built-in Collections

Describes the built-in collections that you can include in an expression, for example, Fields, Parameters, and Variables.

=Fields!Sales.Value

=Parameters!Store.Value

=Variables!MyCalculation.Value

Built-in Report and Aggregate Functions

Describes the built-in functions such as Sum or Previous that you can access from an expression.

=Previous(Sum(Fields!Sales.Value))

Using Common Function and Assembly References (Report Builder 2.0)

Describes how you can access built-in CLR classes Math and Convert, other CLR classes, Visual Basic run-time library functions, or methods from an external assembly.

=Sum(Fields!Sales.Value)

=CDate(Fields!SalesDate.Value)

=DateAdd("d",3,Fields!BirthDate.Value)

Using Custom Code References in Expression

Describes how you can access custom code that is embedded in your report or that you compile and install as a custom assembly on both the report client and the report server.

=Code.ToUSD(Fields!StandardCost.Value)

For more examples, see Expression Examples (Report Builder 2.0).

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft