dbTalk Databases Forums  

Printing Multiple Layouts (Pages) to One Report

comp.databases.filemaker comp.databases.filemaker


Discuss Printing Multiple Layouts (Pages) to One Report in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
senriz
 
Posts: n/a

Default Printing Multiple Layouts (Pages) to One Report - 10-14-2009 , 08:42 AM






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?

Reply With Quote
  #2  
Old   
Your Name
 
Posts: n/a

Default Re: Printing Multiple Layouts (Pages) to One Report - 10-14-2009 , 03:12 PM






"senriz" <dbsenriz (AT) gmail (DOT) com> wrote

Quote:
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?
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 )

Reply With Quote
  #3  
Old   
senriz
 
Posts: n/a

Default Re: Printing Multiple Layouts (Pages) to One Report - 10-14-2009 , 03:48 PM



On Oct 14, 1:12*pm, "Your Name" <your.n... (AT) isp (DOT) com> wrote:
Quote:
"senriz" <dbsen... (AT) gmail (DOT) com> wrote in message

news:32c57d8e-032c-499a-82f7-f659a567747d (AT) a39g2000pre (DOT) googlegroups.com...





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?

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 todo
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 *)- Hide quoted text -

- Show quoted text -
Thanks!! I'll try that and let you know how it goes.

Reply With Quote
  #4  
Old   
Your Name
 
Posts: n/a

Default Re: Printing Multiple Layouts (Pages) to One Report - 10-14-2009 , 07:19 PM



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 )

Reply With Quote
  #5  
Old   
senriz
 
Posts: n/a

Default Re: Printing Multiple Layouts (Pages) to One Report - 10-15-2009 , 05:37 PM



On Oct 14, 5:19*pm, "Your Name" <your.n... (AT) isp (DOT) com> wrote:
Quote:
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 *)
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

Reply With Quote
  #6  
Old   
Your Name
 
Posts: n/a

Default Re: Printing Multiple Layouts (Pages) to One Report - 10-16-2009 , 12:16 AM



"senriz" <dbsenriz (AT) gmail (DOT) com> wrote

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

Reply With Quote
  #7  
Old   
senriz
 
Posts: n/a

Default Re: Printing Multiple Layouts (Pages) to One Report - 10-17-2009 , 09:38 PM



On Oct 15, 10:16*pm, "Your Name" <your.n... (AT) isp (DOT) com> wrote:
Quote:
"senriz" <dbsen... (AT) gmail (DOT) com> wrote in message

news:a2e8796e-acd0-4593-b6bf-0e7b0e401ab0 (AT) m7g2000prd (DOT) 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 simplynot
possible to know the total number of pages that will be printed due to
FileMaker’s inaccurate Preview Mode ... that means your Preview / Go ToLast
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 0at
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 calculationis:
* * * 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 *)
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.

Reply With Quote
  #8  
Old   
Your Name
 
Posts: n/a

Default Re: Printing Multiple Layouts (Pages) to One Report - 10-17-2009 , 11:49 PM



"senriz" <dbsenriz (AT) gmail (DOT) com> wrote

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

Reply With Quote
  #9  
Old   
senriz
 
Posts: n/a

Default Re: Printing Multiple Layouts (Pages) to One Report - 10-28-2009 , 03:11 PM



On Oct 17, 9:49*pm, "Your Name" <your.n... (AT) isp (DOT) com> wrote:
Quote:
"senriz" <dbsen... (AT) gmail (DOT) com> wrote in message

news:84f50922-b923-4ca7-8fcf-99b7df802831 (AT) a37g2000prf (DOT) 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 *)
Sure enough. That is what happened. Thank you.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.