Mastering OLAP Reporting: Display a Dataset Field in a Report Page Header - Page 6

January 16, 2006

Procedure: Display a Dataset Field within the Report Page Header

All that remains in completing the modifications to the report is to add a Page Header, from which we will display the page information, coupled with the respective Sales Reason Type that is presented on the report.

1.  From the main menu, select Report --> Page Header, as shown in Illustration 38.


Illustration 38: Adding a Header to the Report ...

The Page Header area appears in the Layout view.

2.  Drag the Body bar (separating the Page Header from the Report Body) down to the fourth or fifth "tick" on the meter appearing on the left side of the canvas, as depicted in Illustration 39.


Illustration 39: Increasing Height of the Page Header ...

3.  Drag a textbox from the Toolbox to the right side of the report Page Header, as shown in Illustration 40.

Click for larger image

Illustration 40: Adding a Textbox to the Right Side of the Page Header ...

Before we can reference the Sales Reason Type Dataset field, as stipulated in the business requirements, within the Page Header of the report, we need to ascertain the name of the "container" of the Dataset field within the report body.

4.  Right-click the new textbox, leftmost within the Body of the report, which contains the Sales Reason Type value.

5.  Select Properties from the context menu that appears, as depicted in Illustration 41.


Illustration 41: Adding an Expression to the Textbox ...

The Textbox Properties dialog opens, defaulted to the General tab, as shown in Illustration 42.


Illustration 42: Determining the Reference for the Sales Reason Type Report Item ...

We can see that the textbox is named, simply, textbox5 (or similar default Name assigned by the design environment), as seen in Illustration 42 above. I won't go into the value of following a logical object naming convention in this article – although I typically establish such a convention in most engagements – the point here is that, whatever the reference Name, we must know it to use it in the steps that follow.

6.  Click OK to close the Textbox Properties dialog.

Keeping the textbox Name in mind, we will continue with our new textbox in the report Page Header, taking the following steps:

7.  Right-click the textbox we added on the right side of the report Page Header earlier in this section.

8.  Select Expression ... from the context menu that appears, as depicted in Illustration 43.


Illustration 43: Adding an Expression to the Textbox ...

The Expression Editor opens.

9.  Type (or cut and paste) the following expression into the upper pane of the Edit Expression dialog:


= "Page: " & Globals!PageNumber & " of " & Globals!TotalPages & vbcrlf & 
 "Sales Reason Type: " & ReportItems!textbox5.Value

The expression above concatenates the text "Page: " with PageNumber, a member of the Globals collection within Reporting Services. It then concatenates the combination of text " of ," and another Globals member, TotalPages. Next, we insert vbcrlf to tell Reporting Services to begin a new line. We then add the text "Sales Reason Type: " before finally adding a reference to the value of textbox5, a member of the ReportItems collection.

In the above example, we expose an approach to overcoming the obstacle presented by the inability to display a Dataset field directly within the report Page Header. We have drawn the desired Dataset field into the body of the report. Once we have done this, we can use that field, now a member of the ReportItems collection, within the Page Header. Although the header does not allow Dataset fields, it does allow ReportItems members; herein lies our opportunity to achieve our ends – and to meet the business requirements of our hypothetical client.

The Expression Editor appears, with our input, as shown in Illustration 44.


Illustration 44: The Expression Editor with Our Input

10.  Click OK to accept our input to the Expression Editor.

11.  Click the textbox, once more, if necessary to select it.

12.  Adjust the Font size to 8 point, in the toolbar above the Layout tab, as shown in Illustration 45 (or within the Properties pane for the textbox, if desired).


Illustration 45: Adjusting the Font Size ...

13.  Resize the textbox to a width and height that makes sense for the display of its contents, experimenting as desired.

The Page Header of our report appears within the Layout tab, similar to that depicted in Illustration 46.


Illustration 46: The Textbox within the Report Page Header

We have inserted a Dataset field into the Page Header via the knowledgeable use of the ReportItems collection. We will ascertain the effectiveness of our work in the section that follows.

Verification: Preview the Report and Inspect the Successful Display of a Dataset Field within the Report Page Header

Let's preview the report to inspect the results of our handiwork.

1.  Click the Preview tab.

RS025_Dataset Field in Header executes, and returns the data for the default parameter setting, All Products, as shown in Illustration 47.


Illustration 47: The Report Appears – with Dataset Field in the Page Header ...

Advancing pages further confirms the effectiveness of our solution: basing page breaks upon the field, through the mechanism of the Sales Reason Type Group properties settings, ensures that the Dataset field changes appropriately. I hope that this straightforward use of the ReportItems collection lends itself to extrapolation into uses that truly leverage its latent power. This is only one avenue to meeting the immediate requirement; more importantly, it is the tip of the iceberg in possible creative uses for the ReportItems collection.

2.  Select Save --> Save All to save all work to this point.

3.  Select File --> Exit to leave Reporting Services, when ready.

Conclusion ...

In this article, we examined a means of surmounting an apparent shortcoming of Reporting Services, our inability to directly present Dataset fields in the Page Header or footer of a report. As we noted in the introduction to the session, there are different ways to overcome this inconvenience (and that of most perceived deficiencies) in a business intelligence application as flexible as Reporting Services. We explored one of these approaches, the use of an "alias," supported by the ReportItems collection exposed within the Reporting Services development environment.

As a part of preparing the backdrop for a practice exercise surrounding the setup of support for the display of a Dataset field within a report Page Header, we created a copy of an existing OLAP sample report to leave the original intact for other uses. We made structural changes to the clone report, based upon a sample SQL Server Analysis Services cube, to meet the business requirements of a hypothetical group of information consumers, including the need to display a Dataset field in a report Page Header. Finally, we previewed the report to ascertain the effectiveness of our solution. Throughout our practice session, we discussed the results obtained within the development techniques that we exploited.

» See All Articles by Columnist William E. Pearson, III

Discuss this article in the MSSQL Server 2000 Reporting Services Forum.

MSSQL Server Reporting Services
Introducing the Tablix Data Region: Basic Grouping Concepts
Introducing the Tablix Data Region in Reporting Services 2008
100% Stacked Column Chart for Analysis Services Data
XY (Scatter) Chart for Analysis Services Data
Simple Doughnut Chart for Analysis Services Data
Exploded Pie Chart for Analysis Services Data
Stacked Bar Chart for Analysis Services Data
Line Chart for Analysis Services Data
Stacked Column Chart for Analysis Services Data
A More Advanced Pie Chart for Analysis Services Data
Simple Pie Chart for Analysis Services Data
Simple Bar Chart for Analysis Services Data
Simple Column Chart for Analysis Services Data
Introducing Reporting Services Charts for Analysis Services
Mastering OLAP Reports: Parameterized Grouping
Mastering OLAP Reports: Parameterizing Number of "Top" Items with the MDX TopCount() Function, Part II
Mastering OLAP Reports: Parameterizing Number of "Top" Items with the MDX TopCount() Function, Part I
Mastering OLAP Reports: Parameterizing Number of "Look Back" Periods with the MDX LastPeriods() Function, Part II
Mastering OLAP Reports: Parameterizing Number of "Look Back" Periods with the MDX LastPeriods() Function, Part I
Support Parameterization from Analysis Services - Parameter Defaults
Parameterization from Analysis Services - Cascading Picklists
Support Parameterization from Analysis Services
Parameter Support Objects, Pt II: Support OLAP Parameter Defaults with Datasets
Reporting Services: Customize Automatically Created Parameter Support Objects
Snapshot Reports II: SQL Server Management Studio Perspective
Snapshot Reports I: Report Manager Perspective
Report Execution Caching II: Report Manager Perspective
Report Execution Caching I: SQL Server Management Studio Perspective
Report Session Caching in Reporting Services 2005
Black Belt Administration: Reporting Services Configuration Manager
Intelligent Layering: Leverage Conditional Formatting Logic from Analysis Services
Black Belt Administration: Performance Dashboard for Microsoft SQL Server, Part II
Black Belt Administration: Performance Dashboard for Microsoft SQL Server, Part I
Mastering OLAP Reports: Extend Reporting Services with Custom Code
Mastering OLAP Reports: Parameters for Analysis Services Reporting, Pt. II
Black Belt Components: Support Simple Navigation with a Document Map
Mastering OLAP Reports: Parameters for Analysis Services Reporting, Pt. I
Black Belt Components: Interactive Sorts within a Matrix Data Region
BlackBelt Authoring: Conditional Drillthrough to Multiple Reports
Mastering OLAP Reporting: Prototype KPIs in Reporting Services
BlackBelt Administration: Linked Reports in SQL Server Management Studio
BlackBelt Administration: Linked Reports in Report Manager
Mastering OLAP Reporting: Reporting with Analysis Services KPIs
Report Builder: Creating a Report Model
Mastering OLAP Reporting: Meet Business Needs with Matrix Dynamics, Part II
Mastering OLAP Reporting: Meet Business Needs with Matrix Dynamics, Part 1
Mastering OLAP Reporting: Display a Dataset Field in a Report Page Header
Interactive Sorting Within Reporting Services
MSSQL Server Reporting Services: Mastering OLAP Reporting: Multiple Value Selection in a Parameter Picklist
MSSQL Server Reporting Services : Mastering OLAP Reporting: Drilling Through Using MDX
MSSQL Server Reporting Services: Mastering OLAP Reporting: Relationally-Based Picklists for OLAP Reporting
MSSQL Server Reporting Services: Mastering OLAP Reporting: Extending Conditional Formatting: SWITCH and Drilldown Defaults
MSSQL Server Reporting Services: Mastering OLAP Reporting: Percent of Total - Chart Presentation Nuances
MSSQL Server Reporting Services: Mastering OLAP Reporting: Percent of Total - Two Perspectives
MSSQL Server Reporting Services : Mastering OLAP Reporting: Ad Hoc TopCount and BottomCount Parameters
MSSQL Server Reporting Services: Black Belt Components: Ad Hoc Sorting with Parameters
MSSQL Server Reporting Services: Black Belt Administration: "Governor" Capabilities: Report Execution Timeout
MSSQL Server Reporting Services : Black Belt Administration: Execution Log Performance and Audit Reports
MSSQL Server Reporting Services: Black Belt Administration: Prepare the Execution Log for Reporting
MSSQL Server Reporting Services: Black Belt Components: Ad Hoc Conditional Formatting for OLAP Reports
MSSQL Server Reporting Services : Black Belt Components: Manage Nulls in OLAP Reports
MSSQL Server Reporting Services: Reporting Services Basics: Create a Reusable Template Report
MSSQL Server Reporting Services: Master Chart Reports: Track Exchange Rates in a Line Chart
MSSQL Server Reporting Services: Master Chart Reports: Pie Charts in Reporting Services
MSSQL Server Reporting Services: Mastering OLAP Reporting: Cascading Prompts
MSSQL Server Reporting Services: Managing Reporting Services: Data-driven Subscriptions, and External Data Sources for Subscriber Data
MSSQL Server Reporting Services: Managing Reporting Services: Report Execution and Standard Subscriptions
MSSQL Server Reporting Services: Managing Reporting Services: Data Connections and Uploads
MSSQL Server Reporting Services: The Authoring Phase: Overview Part II
MSSQL Server Reporting Services: The Authoring Phase: Overview Part I
MSSQL Server Reporting Services: A New Paradigm for Enterprise Reporting








The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers