Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I show data in the header of a SQL 2005 Reporting Services report?

Out of the box SSRS reports cannot have data exposed in the page header. Is there a way to get this data to show?

like image 966
Chris Woodruff Avatar asked Sep 15 '08 15:09

Chris Woodruff


3 Answers

One of the things I want in my reports is to have nice headers for my reports. I like to have a logo and the user's report parameters along with other data to show to give more information for the business needs the report needs to clarify. One of the things that Microsoft SQL Server 2005 Reporting Services cannot do natively is show data from a Dataset in the header. This post will explain how to work around this and how easy it is.

Create the Report Server Project in the Business Intelligence Projects section and call it AdventureWorksLTReports. I use the AdventureWorksLT sample database from CodePlex.

alt text http://www.cloudsocket.com/images/image-thumb.png

Next show the Page Header by right clicking in the Report area with the designer.

alt text http://www.cloudsocket.com/images/image-thumb1.png

The Page Header will appear. If you want to show the Page Footer this can be accessed from the same menu as the Page Header.

alt text http://www.cloudsocket.com/images/image-thumb2.png

I created a stored procedure that returns data for the Sales Order to be presented in the Page Header. I will show the following information about the Sales Order in the Page Header:

  • Order Date
  • Sales Order Number
  • Company
  • Sales Person
  • Total Due

I create a TextBox for each of my data fields in the Page Header along with a TextBox for the corresponding label. Do not change the Expression in the TextBoxes that you want the Sales Order data in.

alt text http://www.cloudsocket.com/images/image-thumb3.png

In the Report Body, place a TextBox for each data field needed in the Page Header. In the Visibility for each TextBox, select True for Hidden. This will be the placeholder for the data needed in the Page Header.

alt text http://www.cloudsocket.com/images/image-thumb4.png

Your report should look similar to the screenshot shown below.

alt text http://www.cloudsocket.com/images/image-thumb5.png

The last step and most important is to reference the Hidden TextBox in the TextBoxes located in the Page Header. We use the the following Expression to reference the needed TextBoxes:

=ReportItems!.Value

Your report should now look similar to the following:

alt text http://www.cloudsocket.com/images/image-thumb6.png

Your Report preview should now have the Sales Order Header data in the Report Header.

alt text http://www.cloudsocket.com/images/image-thumb7.png

like image 170
Chris Woodruff Avatar answered Sep 28 '22 00:09

Chris Woodruff


You have to do it through Parameters. Add a parameter for each piece of data you would like to display, then set the parameter to Hidden. Then set the default value to "From Query" and set the Dataset and Value field to the appropriate values.

like image 35
Orion Adrian Avatar answered Sep 28 '22 01:09

Orion Adrian


I think the best option is creating a internal parameter, with the default value the field of the dataset you want to show.

like image 41
Ivan Comino Avatar answered Sep 28 '22 01:09

Ivan Comino