Report Items

Another way to create an expression is to use the ReportItems collection. To refer to report items in an expression then use the syntax:

ReportItems!TextboxName.Value

For example, when you drag the Base Amount field from Ledger Line onto a summary section, the default text box name given to it is baseAmount_amount. This is then referred to in an expression as:

ReportItems!baseAmount_amount.Value

Example:

=(ReportItems!baseAmount_amount.Value)/1000

Report item expressions can only refer to other report items within the same grouping scope or a containing scope. For example, where a report has an AccountCode as a grouping then it is possible for a report item placed in a Detail section to refer to report items on the AccountCode group but not for a report item placed on the AccountCode group to refer to report items within the Detail section.

The exception to this is when you create an expression on a page header or page footer. In this case, you can refer to a First or Last report item in the body of the report.

First and Last are aggregate functions like Sum and Avg.

Example:

=First(ReportItems!accountCode.Value)

This results in the first row being printed on the page for the group in which the accountCode report item is contained. If the report item is not printed on the page then nothing is displayed.

Note:  SunSystems Reporting Services provides a simple PageTotal summary function to allow you to add a field directly to a page header or footer, without you having to create a special expression.