p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 (http://p2p.wrox.com/forumdisplay.php?f=251)
-   -   "ReportItems" collection re header/footer (http://p2p.wrox.com/showthread.php?t=45189)

cdubose July 13th, 2006 12:31 PM

"ReportItems" collection re header/footer
 
On page 270 of the book, in a section entitled "Working with the strengths and limitations of the architecture", there is a table that enumerates many of the limitations and offers workarounds and alternatives.

For the limitation "Page header and footer cannot reference field values", one of the alternatives offered is "Place hidden text boxes in the report body and then reference these in the ReportItems collection".

That's it -- nothing else. A check of the index shows no further references to "ReportItems collection".

I presume this is done as custom code or in the "code" box?

How exactly would this be done?

Cynthia

dduvarney July 13th, 2006 12:43 PM

The Report Items collection can be used in expressions. Very similar to how you use the fields colleciton. If you want to reference the field "FirstName" your texbox will contain the expression "=Fields!FirstName.Value".

So, if you put a textbox on your report called "MyTextBox", you can reference it using its name. In your header place another textbox and give it the expression "=ReportItems!MyTextBox.Value". If that doesn't work, try "=ReportItems!MyTextBox.Text".


cdubose July 13th, 2006 01:05 PM

Thank you!

Cynthia

jmbaute August 2nd, 2006 04:21 PM

I've noticed that if your report spans multiple pages, the textboxes in the header seem to lose the reference to the hidden cell beyond page one...is there a way around this?

cdubose August 2nd, 2006 07:32 PM

I JUST discovered this myself!!! This is awful. I don't know the answer -- anyone??

Cynthia

jmbaute August 3rd, 2006 07:08 AM

My problem was (is) that my data table spans mulitple pages. I found a work around, though I am not satisfied it is the best solution: added a hidden column to my table, containing my hidden textbox referencing the parameter. As the table propogates to the other pages, so do the hidden fields.

Seems to work.


cdubose August 3rd, 2006 11:12 AM

Yes, I tried that too. It works in the Visual Studio preview.

However, when I exported the report to PDF format, it did not work. All the fields in header/footer that depended on hidden information in the tables were blank.

Unfortunately, we are required to use the PDF format for our reports, because of the quirk (feature?) in SSRS 2005 that makes HTML format come out wrong if there are overlapping elements. We just can't get away from overlapping elements in our reports.

I have come up with a solution, I think, that will work for me -- the header can apparently accept report parameters. Since the variable information in the header is consistent over an entire report in my case, this will work for me, though it's inconvenient. (Much of the information in the header previously came from just one report parameter, and now I have to send several.)

However, I have another problem. Our reports are required to have totals in the footer of each page. Originally, I tried picking up the data from the (hidden) table footer, and again, it worked in the Visual Studio preview, so I thought I had solved that problem. Much later, when I exported to PDF, I discovered that the footer fields came out blank. (Trust me, you didn't want to be within earshot of me when this discovery was made!)

The totals are required to be group totals -- totals from one of the groups in the table. That means that even if I used a subreport in the footer (which I don't even know will work), I would have to somehow send it the ID of the current group, and I don't know how to do that.

I may have to do something with code, saving the totals in global variables or the like -- but I don't know how to do that. It's a mess.

Cynthia

jmbaute August 3rd, 2006 12:13 PM

Ack...you're right. I also see that I get extra pages in my PDF, basically blank pages with a header inserted between the real data.

We may be the only ones posting here ?

Any ideas?

John

jmbaute <at> yahoo.com


cdubose August 3rd, 2006 01:06 PM

I think the problem with the extra pages is caused by the report being too wide for the PDF format. You can usually fix that by tweaking the margins in your report.

Unfortunately, the other problem is not so easily solved!

Yes, no one else seems to be hearing our problem, though surely others must have run into this.

Cynthia

jmbaute August 3rd, 2006 01:11 PM

Yep...somehow my page had drifted .125 inches. Well, I am out of ideas. Hopefully one of the experts will check in here soon. Good luck.

John



All times are GMT -4. The time now is 07:57 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.