How to Spruce-up Your SCCM Reports by Adding Page Numbers

by | Aug 22, 2018 | ConfigMgr, How-To, SQL Server Reporting Services, Tips

Last updated on August 6th, 2022 at 04:02 pm

In this day and age, why would you need to add page numbers to a report? Well, the first reason should be obvious. Even in a “paperless society” sometimes a report needs to be printed, so if it does, adding page numbers is a great way to keep the pages of the report organized. Not to mention that it also tells you how many sheets of paper you’ll need to print it on. The second reason why adding page numbers to a report makes sense is not so obvious because it has to do with a SQL Server Reporting Services (SSRS) issue.

Before getting to that issue, though, let me tell you that I have seen my fair share of multiple-paged reports printed time and time again. Then you know the drill. Page after page is flipped as the information is reviewed. A tidbit of data is flagged here and there, and maybe even pages are put into separate piles. This is all fine until one of your colleagues walks past the sheets of paper and they all go flying! It can be frustrating trying to reorder the pages correctly and sometimes simply reprinting the report is faster than trying to figure out which page goes where.

Instead of wasting paper and toner, try adding page numbers. Many moons ago, when I attended college we used punch cards. Yes, punch cards! One day I dropped a stack of them (this was for a cool assignment using PDP-11). Needless-to-say the cards were not in order when I picked them up. Frustrated, I turned for advice to my Dad who worked with punch cards a lot. He told me to write a number on each card (similar to page numbers) and this way if they ever got out of order again, I could easily reorder them without too much trouble.

SSRS Issue

Adding Page Numbers - 2 Different Reports

Take a look at these two reports. Can you see how the page numbers are displayed differently?

Adding Page Numbers - Enlargement Area

I’ve enlarged and flagged the relevant section. The first report says that the current page is 1 of 2 ? and the second report says that the current page is 1 of 2. What does the question mark ? in the first report indicate? Does it mean anything?

Adding Page Numbers - 39 Pages

In actuality, this report is 39-pages long, so you can’t ignore the question mark.

Why, then, does this happen?

Adding Page Numbers - No Page Numbers

Here’s a look at page 39.

Usually page numbers appear either in the top right or somewhere along the bottom of the page. Notice, however, in this example that there are no page numbers on the report itself. Yes, page numbers appear in the SSRS toolbar, but not on the report itself.

Adding Page Numbers - Second Report

Let’s look at the second report. The page number information, Page 1 of 2, appears within the footer. When this information appears in the report itself, it enables SSRS to detect the number of pages in a report. The correct information is then displayed on the SSRS toolbar.

Instead of guessing the number of pages in a report from the SSRS toolbar on the first screen, try adding page numbers to a report! This is one of those little things that can really make a difference. A little later I’ll show you how to add page numbers within a footer, but first I’ll show you how to add a footer to a report.

How to Add a Footer to a Report

Adding Page Numbers - Add Page Footer

This report doesn’t have a footer, so in order to add one I first have to ensure that the design tab is active. Next, I click on the Report tab and select Add Page Footer. Wasn’t that easy?

Adding Page Numbers - Footer Area

You can see in the screenshot above that I highlighted the footer area after adding it.

Adding Page Numbers to a Report

Adding Page Numbers - Text Box

Within the footer area, add a text box.

Adding Page Numbers - Text Box Properties

Right-click on the text box and select Text Box Properties…

Adding Page Numbers - Expression Text Box

In the expression text box, paste the expression listed below and then click OK.

=String.Format(“Page {0} of {1}”, Globals!PageNumber,Globals!TotalPages)

Page Number Expression

What does this expression do? In simple terms, it displays the current page number followed by the total number of pages, i.e. Page 1 of 2. You can see what I mean when you view the report screenshot below. Additionally, it uses built-in global variables for the current page number and the total number of pages. These are automatically populated when the report is generated. I intend to write more about these global variables in future posts.

Adding Page Numbers - Updated Footer

If you have any questions about adding page numbers to SCCM reports, please feel free to contact me @GarthMJ.