"senriz" <dbsen... at (no spam) gmail.com> wrote in message
news:a2e8796e-acd0-4593-b6bf-0e7b0e401ab0 at (no spam) m7g2000prd.googlegroups.com...
Thanks. I will keep that in mind. I haven't gotten to the
"landscape" forms yet... just working on the first few which are all
portrait. I'm using FMP 9 Advance. Below is my script so far and
it's working perfectly. Your instructions were very helpful... I had
a nested if statement that was causing the problem. Can you advise me
on how I might add a TotalPageCount... like Page __ of "__"?
Snip a Script
There are three possibilities ...
VARIABLE LENGTH FORMS
If the number of pages for any Form can vary depending on the data (i.e.
Form 4 might sometimes be 2 pages, sometimes 3 pages), then it’s simply not
possible to know the total number of pages that will be printed due to
FileMaker’s inaccurate Preview Mode ... that means your Preview / Go To Last
Page Script won't always give the correct answer.

(
SINGLE PAGE FORMS
If ALL the Forms are only one page long, then it’s very easy.
First you can calculate the total number of pages for the entire report by
simply adding up all the checkbox values (since they are either 1 or 0). It’
s probably easiest to calculate this value at the start of the Script and
store it in a Global Field or Variable.
The “current” page number for each Form can be set using a second Global
Field / Variable as the Script runs through, remembering to reset it to 0 at
the start of the Script.
Both Fields / Variables can be put in the Footer of each Layout. It’s
probably easiest to use Merge Fields.
e.g.
Page <<g_Current>> of <<g_Total
This means your printing / PDFing Script would be something like:
Set Field [g_Current; 0]
Set Field [g_Total; Form1 + Form2 + Form3 + ...]
If Form1 = 1
Set Field [g_Current; g_Current + 1]
Go To Layout [Layout1]
Page Setup [Restore; No Dialog]
Print []
End If
If Form2 = 1
Set Field [g_Current; g_Current + 1]
Go To Layout [Layout2]
Page Setup [Restore; No Dialog]
Print []
End If
If Form3 = 1
Set Field [g_Current; g_Current + 1]
Go To Layout [Layout3]
Page Setup [Restore; No Dialog]
Print []
End If
... {continue for all necessary Forms}
MULTI-PAGE FORMS
If some / all of the Forms are multiple pages (but each is always the same
number), then it might be easier to not bother trying to number the pages,
but instead use the above method to number the Forms rather than pages in
the Footers.
i.e.
Form <<g_Current>> of <<g_Total
Trying to actually number the pages will get a bit messy – the easiest
approach is probably to split each Form’s pages into separate Layouts, and
then use the same method above. So if Form 2 is three pages long, then it
would become three separate Layouts and that section of your Script would
become:
If Form2 = 1
Set Field [g_Current; g_Current + 1]
Go To Layout [Layout2_Page1]
Page Setup [Restore; No Dialog]
Print []
Set Field [g_Current; g_Current + 1]
Go To Layout [Layout2_Page2]
Page Setup [Restore; No Dialog]
Print []
Set Field [g_Current; g_Current + 1]
Go To Layout [Layout2_Page3]
Page Setup [Restore; No Dialog]
Print []
End If
You would also need to modify the total pages calculation to multiply the
appropriate checkbox value by the number of pages for that Form.
e.g.
If ALL Forms have two pages, the calculation is:
Set Field [g_Total; Form1 * 2 + Form2 * 2 + Form3 * 2 + ...]
or more simply:
Set Field [g_Total; (Form1 + Form2 + Form3 + ...) * 2]
If the Forms have differing numbers of pages, the calculation is:
Set Field [g_Total; Form1 + Form2 * 3 + Form3 * 4 + ...]
when Form 1 has one page, Form 2 has three pages, and Form3 have 4
pages.
Helpful Harry

)