Thursday, May 28, 2009

Page Numbers in SSRS

So I just spent 30 minutes trying to get a page number on the bottom of a report I’m building in SSRS.  30 minutes for a feature that I get in a button-click in virtually every other application that I have installed on my computer.

The adventure starts with this TechNet article that seems to indicate that this is all simple to do:

Adding a Page Number to a Header or Footer

Footers commonly display a page number. To display a page number in the header or footer of a report, create a text box in the footer and add the following expression:

=Globals.PageNumber & " of " & Globals.TotalPages

Ok, let’s do that.  Sounds straightforward enough.  Oh wait… then I get this:

The Value expression for the textbox ‘textbox1’ refers to the global variable PageNumber or TotalPages.  These global variables can be used only in the page header and page footer.

What the hell?  Ok, let’s do some Googling (which reminds me, I love that “To Google” is now a valid part of the English language… what a world).  This lead me to a few different forum and blog posts.  All of these seemed to indicate that I had to write backend code to make this work.  Stupidly, I thought “sure, why not? It seems totally reasonable that I should have to write custom code to get PAGE NUMBERS ON A REPORT”.

I realize I don’t get to write code that often anymore, never mind writing a report.  So I’m a little rusty.  But am I so rusty that I’ve forgotten my core lesson that “if it seems too complicated you probably screwed up”?

Thankfully writing this blog rant reminded me of that fact midway through this and I thought “alright, it’s gotta be me, not the tool”.  Of course, as always, foolishness usually lies with the user of the tool not the tool itself.  Suffice it to say there’s a BIG difference between a table footer and a page footer.  Whoops.

In my defence, adding a page number in Word (or anything like it) is about as simple as can be.  Given that SSRS is meant to simplify the creation of reports, why is it so hard to do trivial tasks?  Ok, I’m exaggerating, it wasn’t that hard.  But it’s always fair to blame the tool, right?

1 comment:

ADmin said...

When you have discovered your subject, the following http://www.uk-essay.net/essays thing to keep tabs on is the structure of your exposition.