Page Count - Output Format
fp at casabellagallery.com
fp at casabellagallery.com
Thu Sep 27 06:07:33 PDT 2007
Ken wisely suggested:
> > I'm sure this has been asked and answered before, but could someone
> > revisit with me how to calculate the number of pages for a report in
> > order to print "Page n of n" on an output format?
> >
> > I'm thinking it would involve a records per page count and formula of
> > some sort?
>
> Well, if you're not using "remove unwanted blank lines", nor page breaks
> on subtotals, nor print any subtotal information, nor are you changing
> the output via PRINT or PAGE, then you know exactly how many records
> will print per page, and you know how many records were selected (@TS),
> so you simply take @TS/records_per_page and round up.
>
This method is the easy way and hopefully, your problem is that simple!
> Otherwise, you don't know how many pages will print until after they
> have been printed. In that case, you could put something like "page
> n of [PAGECOUNT]" on the output, send it to a file, and post-process
> the file, replacing "[PAGECOUNT]" with the actual page count.
>
This method is just a bid harder but not by the 10th degree. Should
you ask how then can I replace PAGECOUNT and how do I know what to
replace it with?
I do not know how but have an idea 8-) Of course, assuming you are
running *NIX of some sort. This is what I would try (having printed
to a file as suggested by Ken):
(1)
@pn hold the page number and @ts holds the total records selected. Keep
track of processed records and run a routine after last record is printed
but before you 'END' your processing. In this routine, you will run
system command passing filename and @pn as parameters. The command you
are running could be 'awk', 'sed' or combination of both to search for and
replace PAGECOUNT with @pn - This command should barely blink. By now, you
have successfully solved your PG of PG problem, now go on and print file.
Oh, do not forget to !@pn of PAGECOUNT on your report.
(2)
After report is printed to file, pipe it to 'wc -l' to get the total lines
printed. Use this to determine how many pages should print and using 'awk',
'sed' or combination of both replace string PAGECOUNT with figured number of
pages.
(3)
If printing to a laser, see if there is a way you can dump a macro from printer
to print the page count for that print job. I do not know why but it seems
that I have read something about this some time ago and it feels that printing
page count is possible by interacting with printer. Jim may know this if at
all possible.
Good luck!
---
Jose Lerebours
954 559 7186
http://www.fpgroups.com
More information about the Filepro-list
mailing list