Conditional Page Footer

Sunday 11 May 2008 @ 10:22 pm

Crystal will allow you to conditionally suppress a Page Footer. But even when the section is suppressed, the space it would have taken up is still there, reserved as blank space at the bottom of the page. This is because other features like ‘can grow’ and “keep group together” make the job of determining the page size very complex.

There is a related option for page footers called “reserve minimum space” but this only applies if you have multiple page footers and are conditionally choosing between them. Activating this feature will reserve space for only the largest of the sections. It works best if you want to choose one out of several page footers. But if a page ever exposes two sections, and if they combine to form a Page Footer that is larger than what is reserved, you will end up with a Page Footer that runs off the page.

However, if you are NOT using “keep group together” or “can grow” then there is a possible (but complex) workaround. You can create a second detail section and set it to “print at bottom of page”. This can create a pseudo Page Footer if you suppress the section on most records and only display it on the Detail that would print last on each page. The tricky part is calculating the position on the page. It requires a running total based on a variable. You need a formula in each printing section that adds the height of that section to the running total variable. You then suppress the section until the variable reaches the page length. The suppress condition can be something like this:

NumberVar Position < 7.6 //the printable page height
or PageNumber > 5 // your desired condition for the page footer

The first condition makes sure it is only going to print at the bottom of any page. The second condition makes sure it only prints on the pages on which you want it to appear. Because this section is not a true Page Footer it can be conditionally suppressed without reserving space.

If you have never worked with variables or used them to create running totals you might want to get my Expert’s Guide to Crystal Reports Formulas.

(For examples of my most popular formulas, please visit the FORMULAS page on my website.)

Leave a Reply

Recrystallize Pro

Crystal Reports Server