[thelist] reporting, line count, many pages, best practices

Luther, Ron Ron.Luther at hp.com
Fri Nov 18 09:08:13 CST 2005

VOLKAN ÖZÇELIK asked about pagination housekeeping for reporting:

Hi Volkan,

A couple of notes:

(1) If you have the budget, pretty much any contemporary report writer package (Brio/Hyperion, Business Objects, Crystal, Oracle Reports, etc.) handles this kind of thing for you really well.  IIRC they all have simple functions for page totals and cumulative totals (and percentages) as well.  [Sometimes it's kinda nice to throw that 'page 1 total is $567,234 which is 26% of the grand total' at the bottom of the page.] They also handle things like users changing font sizes on you or situations where you have some users printing A4/A5 and some printing 8.5 by 11 where your 'row per page' counts can differ and throw off your nice formatting.

(2) <REALLY 'old school' - but still useful - tip> ASCII character 12 (decimal) is your friend.  Use liberally.  This is the 'form feed' character and issues a "go to the top of the next page" command to your printer. [Disclaimer - I haven't used this in quite a few years but I assume it still works well.]  

Hint: It's lots easier and simpler to issue one 'form feed' than 47 'carriage return's.   ;-)

That should take care of your 'widow' problems. [1]  [Printing the headers at the bottom of the page and then the data on the following page.]

(3) If you are looking for an additional challenge, consider adding some 'look forward' logic to gracefully handle 'orphans' [1].  [Users don't want to see 54 lines of detail on page 1, a total all by itself on page 2, and then the next product with details on page 3. {You *can* do that - but then you want additional layers of headers to add the proper context for the total.  Your choice on which is 'more appropriate' for your app and users.}]  

If you add in some logic based on modulo arithmetic, (since the number of detail records for product 'zed' is 0Mod(54) the last detail record will print on the last line of some page - if you can print 54 detail records on a page of course), then you can 'back off' a line or two from each of the preceeding detail pages to make sure you have a few lines of detail left to print on the last page along with the total.

A bit of a 'fiddly bit' and not _really_ necessary, but it can be a nice touch and one that not every app pulls off well.

>>I just missed my Commodore64 days :)

No doubt.  This certainly sounds like an old tractor-feed green bar report problem!  ;-)

Good luck and HTH,


[1] Technical terms, I believe, for ugly report pagination issues.  [Make sure, btw, to include the key word 'printing' when googling for 'widows and orphans' otherwise you may end up with ... well ... something entirely different!]

More information about the thelist mailing list