Dundas Gauge for Reporting Services Send comments on this topic
Report Expressions
See Also

Glossary Item Box

This topic discusses report expressions.

Overview of Report Expressions

Reports often need values that are not fixed (e.g. retrieved from some column value in a row set). This is where expressions come into play, since they allow for multiple column values, concatenation, mathematical formulas, and more.

Expressions are evaluated when a report is executed.

Expressions can:

Numerous string properties can be set by the Expression Editor, which can be launched by clicking on the expression icon next to a relevant property displayed in a dialog.

 

Expression Editor

Figure 1: Report Expression Editor.

 

Syntax and Expression Examples

The syntax for report expressions is "=Operator(Fields!ColumnName[,"DatasetName"])".

Note that qualifying the expression with the dataset name is not required if a textbox has an expression icon () beside it.

Example 1

Expression: "=Sum(Fields!LineTotal.Value)" (without specifying dataset name)
Expression: "=Sum(Fields!LineTotal.Value,"SalesDetails")" (specifying dataset name)

Evaluates to: the sum of the LineTotal column values for the SalesDetails dataset.

Example 2

Expression: "=4*AVG(Fields!LineTotal.Value)" (without specifying dataset name)
Expression: "=4*AVG(Fields!LineTotal.Value,"SalesDetails")" (specifying dataset name)

Evaluates to: 4 times the average of the LineTotal column values for the SalesDetails dataset.

Common Aggregate Functions

The following table lists the more common SQL aggregate functions (i.e. operators), which can be used in expressions:

Function Description
AVG(column value) Gets the average value of a column.
COUNT(column) Gets the number of column rows.
COUNT(*) Gets the number of selected rows.
COUNT(DISTINCT column) Gets the number of distinct values.
FIRST(column) Gets the value of the first record in a specified field (not supported in SQL Server 2000*)
LAST(column) Gets the value of the last record in a specified field (not supported in SQL Server 2000*)
MAX(column) Gets the largest value of a column.
MIN(column) Gets the smallest value of a column.
SUM(column) Gets the total sum of a column.

Refer to the SQL Server documentation for a complete listing of aggregate functions.

See Also

Getting Started
Using The Gauge Control

Gauge Designer Dialog
Gauge Designer Overview

Sub-Gauge Designer Dialog
Sub-Gauge Designer Overview

Grouping and Sorting Properties Dialog
Grouping, Filtering and Sorting Dialog Overview

©2008. All Rights Reserved.