Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Printing Multiple Layouts (Pages) to One Report

296 views
Skip to first unread message

senriz

unread,
Oct 14, 2009, 9:42:32 AM10/14/09
to
I'm a Novice, so here goes... I have a db that has a TO with Names and
a TO with Forms. All the Forms are on One layout using Tabs, which
each Tab Name corresponding to the Form Number. I also have created a
Printable Layout that correspondes to each Tab, hence Tab Name Form1,
Layout Name Form 1. I also have a number field on each layout named
Print1, Print2, ect. that is associated with a Valuelist Checkbox that
has only One value: 1, but on the layout it only shows the checkbox.
This checkbox is checked if the Form is to be printed with other
selected forms into One Report. With that said Form 1, Form 7 and
Form 48 might need to be printed in a single report that will be
number Page __ of __.

I've been trying to write a script that basically would say If Print1
= 1, then go to layout Form 1 and save as PDF and then, go to Print2
and if Print2 = 1, go to layout Form 2 and append to PDF, and so
on... BUT if Print1 = 0, then go to Print2 and if Print2 = 1, go to
layout Form 2 and save as PDF or if Print2 = 0, then go to Print3.
And so on, and so on. THIS IS NOT WORKING FOR ME!!!

I need this script to go through all the forms to see if the field is
checked and if it is, then all those that are checked need to print to
the PDF, with the "Page __ of __."

Can anyone help me?

Your Name

unread,
Oct 14, 2009, 4:12:07 PM10/14/09
to

"senriz" <dbse...@gmail.com> wrote in message
news:32c57d8e-032c-499a...@a39g2000pre.googlegroups.com...

I'm not sure that you can appened to an existing PDF, but assuming newer
versions of FileMaker allow this, then the "printing" Script itself is
fairly easy ... you've already given the basic version above. All you need
is a set of separate If / End If statements.
i.e.
If Print1 = 1
Go To Layout [Form1]
Page Setup [Restore; NoDialog]
Print []
End If
If Print2 = 1
Go To Layout [Form2]
Page Setup [Restore; NoDialog]
Print []
End If
If Print3 = 1
Go To Layout [Form3]
Page Setup [Restore; NoDialog]
Print []
End If
{continue for all Forms required}


The bigger problem is the "Page X of Y". his is going to be impossible to do
thanks to FileMaker's Preview mode not being 100% accurate to what gets
printed / PDFed ... unless each Form is always a single page, then it is
possible using a "Counter" global field / variable.

Helpfull Harry :o)


senriz

unread,
Oct 14, 2009, 4:48:45 PM10/14/09
to
On Oct 14, 1:12 pm, "Your Name" <your.n...@isp.com> wrote:
> "senriz" <dbsen...@gmail.com> wrote in message
> Helpfull Harry  :o)- Hide quoted text -
>
> - Show quoted text -

Thanks!! I'll try that and let you know how it goes.

Your Name

unread,
Oct 14, 2009, 8:19:20 PM10/14/09
to
If the From layouts need different Page Setup options (e.g. one is lanscape,
one is portrait, one is A5, etc.), then in older versions of FileMaker you
will need to use separate sub-scripts to print each Form since a Script can
only store one Page Setup.

Helpfull Harry :o)

senriz

unread,
Oct 15, 2009, 6:37:37 PM10/15/09
to

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 "__"?

Go to Layout [ “IEPForms” (IEP) ]
Enter Preview Mode
Set Field [ Global::gPageNumber; 0 ]
Go to Layout [ “IEPForms” (IEP) ]
If [ ValueCount(IEP::Print1) > 0 ]
Go to Layout [ “Form 1” (IEP) ]
Enter Preview Mode
Go to Record/Request/Page [ Last ]
Set Field [ Global::gPageNumber; Global::gPageNumber + Get
(PageNumber) ]
Print [ Restore; No dialog ]
Go to Layout [ “IEPForms” (IEP) ]
End If
If [ ValueCount(IEP::Print2) > 0 ]
Go to Layout [ “Form 2” (IEP) ]
Enter Preview Mode
Go to Record/Request/Page [ Last ]
Set Field [ Global::gPageNumber; Global::gPageNumber + Get
(PageNumber) ]
Print [ Restore; No dialog ]
Go to Layout [ “IEPForms” (IEP) ]
End If
Enter Browse Mode

Your Name

unread,
Oct 16, 2009, 1:16:18 AM10/16/09
to

"senriz" <dbse...@gmail.com> wrote in message
news:a2e8796e-acd0-4593...@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. :o(

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 :o)

senriz

unread,
Oct 17, 2009, 10:38:00 PM10/17/09
to
On Oct 15, 10:16 pm, "Your Name" <your.n...@isp.com> wrote:
> "senriz" <dbsen...@gmail.com> wrote in message

Thank you so very much!! I got it to work beautifully. I actually
had put each page on a layout all by itself when a form had multiple
pages, so that ended up being a bit easier. Also, I got the Landscape
and Portrait print to work quite well. I add the Print Setup Function
above the Print Function enabling either Portrait or Landscape when a
Form's orientation changed. So if the first Five Forms were Portrait
I only needed to put that Function in the first one, then change it
for Form 6 to Landscape, and then only change it again when one of the
following Forms changed back to Portrait. Again, thank you. Your
instructions were extremely helpful.

Your Name

unread,
Oct 18, 2009, 12:49:49 AM10/18/09
to

"senriz" <dbse...@gmail.com> wrote in message
news:84f50922-b923-4ca7...@a37g2000prf.googlegroups.com...

>
> Thank you so very much!! I got it to work beautifully. I actually
> had put each page on a layout all by itself when a form had multiple
> pages, so that ended up being a bit easier. Also, I got the Landscape
> and Portrait print to work quite well. I add the Print Setup Function
> above the Print Function enabling either Portrait or Landscape when a
> Form's orientation changed. So if the first Five Forms were Portrait
> I only needed to put that Function in the first one, then change it
> for Form 6 to Landscape, and then only change it again when one of the
> following Forms changed back to Portrait. Again, thank you. Your
> instructions were extremely helpful.

Not quite. You'll need to put the Page Setup command in EVERY Form's "If /
EndIf" section - otherwise if they don't choose to print Form 1 the Page
Setup could be set incorrectly (e.g. a left-over from printing just Form 6
previously) whrn printing Forms 2, 3, 4 or 5.

Helpfull Harry :o)


senriz

unread,
Oct 28, 2009, 5:11:19 PM10/28/09
to
On Oct 17, 9:49 pm, "Your Name" <your.n...@isp.com> wrote:
> "senriz" <dbsen...@gmail.com> wrote in message

Sure enough. That is what happened. Thank you.

0 new messages