Eric's Blog

Day to day experience in .NET
Welcome to Blogs @ IRM Sign in | Join | Help
 Search

Disclaimer

The content of this site is my own personal opinion and does not in any way represent my employer, it's subsideries or affiliates. These postings are provided "AS IS" with no warranties, and confer no rights.

This Blog

Reporting Services: Data in a Page Header

I've been using Reporting Services in a couple of projects and I like it many ways, but the product is not complete in it's functionality. One problem that we got stuck with for a while was that it is not possible to use Fields (data from data sources) in the Page Header. This is a big problem if you do things like invoices for example and I see it as a basic and very common needed feature. Luckily there is a work around.
After some googeling the first solution we did was to refer to a textbox in the page body. This seemed to work fine if you repeated the textbox with for example a table, but if the textbox is not part of a page, the value wouldn't be available for the header on that page. This meant that for some pages we had no invoice number and that is not satisfying. Back to Google and we found a suggested solution to use report parameters instead.
So what we did was adding report parameters for each field we wanted to display in the page header. The parameters value we choose to get from a field in a dataset. In the textboxes we refer to the parameters value and it works like a charm on each and every page. There are some issues to watch out for though. The first thing we did was to create a separate dataset for the page header, because when we used an existing dataset that also showed data in the body we got into problem with the fields in the body. We also had big problems with Visual Studio 2003 and the preview in the report designer. It did not work at all when using this solution, but the deployed report works just fine. This makes it harder to develop the report though, so my only suggestion is to do the page header last or upgrade to SQL Server 2005. In SQL Server 2005 also the designer works perfectly and a great new feature  is the possibility to hide these parameters from the user so they won't get prompted for values. The overall feeling of Reporting Services in SQL Server 2005 is that it is a little bit more polished and as I see it is the first version. Still there are missing features and a lot of things that can be improved, but I'm ready to do a lot to get rid of the more mature Crystal Reports, because of all the problems it still have (even though they are on version 11 or something).
Published den 25 maj 2006 06:28 by ericqu
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Eric Hannay said:

Thank you SO much for this comment.  We are redesigning our purchase orders (currently in Crystal), and this lack of support for fields in page headers/footers was an obstacle we could not get around until I read your blog entry.  Kudos to you for posting this work-around.
juli 26, 2006 20:56
 

John Hennesey said:

Thanks!
december 12, 2007 17:03
 

Clarke Pitney said:

Thanks for an easy solution to a problem that really shouldn't exist. Microsoft should change this behavior in SQL Reporting!
mars 18, 2008 17:42
 

Andrea F. said:

You are a god send. I couldn't get the page header data to appear until I made them report parameters.
juni 3, 2008 19:21
 

Carlos said:

Awesome solution...Worked great. Thanks!
juni 12, 2008 22:57
 

mark brunton said:

Can this be done for Bulk printing or is this for just a single invoice
juli 28, 2008 13:29
 

ericqu said:

@mark brunton: I have not tried this with bulk printing and I think that the solution might not be able to handle that scenario. Please let me know.

augusti 13, 2008 10:03
 

Mick L said:

@mark brunton: see http://geekswithblogs.net/Bunch/archive/2008/03/05/data-into-a-ssrs-header-again.aspx
augusti 26, 2008 09:54
 

Jess L.L. said:

http://geekswithblogs.net/Bunch/archive/2008/03/05/data-into-a-ssrs-header-again.aspx
september 10, 2008 12:53
 

Dan said:

You are a genius.
september 23, 2008 11:15
 

Steve O said:

I’m using Reporting Services 2005. I want to add a “report header”, not a “page header”, because I want to see some specific info on the first page only but I don’t know how to add it. Can you help me?
november 12, 2008 20:16
 

ericqu said:

I have not tried that, and actually not done so much Reporting Services lately.

november 12, 2008 21:38
 

Chris said:

@Steve O: Try putting the "Report Header" elements in the regular Page Header section with Visibility>Hidden set to "=Globals!PageNumber>1"
mars 17, 2009 23:06
 

mag said:

Nice.... It works...
juli 9, 2009 17:26
 

andrew said:

yeah, except if you are trying to span print columns. :( i can't believe that by reporting services 2008 they haven't added a report header.
september 21, 2009 22:01
 

Mark said:

I am using the first technique of having the header text box getting a value from another 'source' text box in the report body. Because the body is entirely a table, the ‘source’ textboxes are in cells. I now want to hide the columns that contain the 'source' cells but as soon as I do that the data is no longer copied to the header. I can hide the individual cells but not the entire column or row. Any ideas? Mark.
december 22, 2009 11:36
 

PH said:

I had a similar issue (I'm using SSRS 2008 R2). I was creating invoices for multiple companies using a subreport (the subreport loops through each company). In the footer I wanted to put the Companies name on every page. In order to accomplish this I had to first upgrade to SQL Server and RS to 10.50.2500.0. Then I added a column to my Subreport Tablix on the main report (my tablix is now 2 columns by 1 row). In the new column cell create the expression that you want to display (in my case it was simply the company name from the looping query). After you have written the expression hide only that column and set the width of that column to .03125in. Now create a textbox in your footer and set that expression to the new column cell using =ReportItems!hidden_newcolumncell.Value. The appropriate company name repeats on every page.
augusti 9, 2011 16:19
 

Sandy said:

I realize this is old post, but I have been struggling with this page header issue for days. Your solution provided the results - getting the data to appear on page header even when the table did not (had just the group footer on the last page) which was a huge step forward. However, this data does not seem to be dynamic and change from one invoice to the next. I need the customer name / address and invoice# to appear in the page header on every page and change between invoices. Because they are report parameters are they static for the entire report? Any thoughts / suggestions.
januari 19, 2012 00:54
 

ericqu said:

If I understand you correctly, you have many invoices in the same report and the header should be different for each one of them.

I haven't been designing any reports for a very long time and I might be incorrect, but I would guess that the parameter is the same throughout the report so it will not be a good solution if it needs to vary depending on the data. Could it be possible that the solution with refering to a textbox in the page body would work in your situation?

januari 19, 2012 10:04
 

Sandy said:

Yes, the use of the report parameter is only useful if the data can remain unchanged. I have tried the other solution of refering to the textbox, and it seems to work, it is just that I have about 15 fields that could change between invoices and need to be in the header on every page. Still working on it, but think this is my only option.
januari 22, 2012 23:46
 

raj said:

what if I have a parameter that has multiple value....Like if three invoice are selected to display, then the first invoice that is selected keeps repeating to all page...what I want is the for each inovoice selected the value shoudl change... for values like inv1 inv2 inv3...which is multivalued, the output should go as inv1 first page inv2 second page inv 3 third page, but it is not happening..plesae help
mars 14, 2012 23:22
 

ericqu said:

Isn't this the same situation that Sandy has above?

mars 18, 2012 15:47

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server, by Telligent Systems