by John Mark Osborne, <jmo@best.com>
Page Totals
Using the Status(CurrentPageNumber) Function
BONUS: PAGE_NO.FP3
It is easy enough to show the page number at the top or bottom of each printed page using the Paste Special feature but how do you get the page total? For example, you might want to show the following on the first page of a six page report:
page 1 of 6
In FileMaker Pro 2.0, you could accomplish this task using a calculation field if you always had the same number of records per page. You couldn't have the sliding objects option for reducing the enclosing part turned on, which could be quite limiting if you wanted to fit as many records per page as possible. On top of that, the database would also need to be sorted since the Summary function (called GetSummary in FileMaker Pro 3.0) had to be used. Basically, the solution was very limiting.
In FileMaker Pro 3.0, the solution can be accomplished with a simple script. Even though the solution is not calculation based it shouldn't be too limiting since most people use scripts for printing anyhow. All you will need to do is add a few script commands to your existing print script.
Before you create the script, start by adding a global number field which will store your page total. Then add this field to the layout you want to print either in the header or footer part. Your best bet is to add it as a merge field so you can have even spacing between the word "page", the current page number, the word "of" and the page total.
Now for the script. You will only need to add three script commands to your existing print script:
Enter Preview Mode [ ]
Go To Record/Request/Page [Last]
Set Field ["Page Total", "Status(CurrentPageNumber)"]
This script takes you to the preview mode, goes to the last page and sets the page total field to the current page number. Since the last page will equal the number of pages in your report and the global page total field appears on every record, you will get a page total on every record and thus at the bottom or top of each page.
------------------------------------------------------------------------------
Database Pros
by John Mark Osborne
"The Best FileMaker Resource on the Internet"
Mountain View, CA
http://www.best.com/~jmo
------------------------------------------------------------------------------
## END ##