5 Replies Latest reply on Aug 4, 2014 9:12 AM by philmodjunk

    Saving as PDF from two different layouts



      Saving as PDF from two different layouts




           I have two different layouts and I want to make a pdf file. 

           I have a script that makes me a PDF from first layout.

           My problem is, that in the middle of this PDF I need to insert three pages from second layout to get something like this:


           Layout 1, page 1

           Layout 1, page 2

           Layout 1, page 3

           Layout 1, page 4

                 Layout 2, page 1

           Layout 1, page 5

           Layout 1, page 6

                 Layout 2, page 2

           Layout 1, page 7

                 Layout 2, page 3

           Layout 1, page 8






           Any ideas?

        • 1. Re: Saving as PDF from two different layouts

               You'll need to modify your approach. Am I correct that the different sections of your Layout 1 pages represent different subsets of the found set of records on layout 1? (One set of records is for pages 1-4, the next set for pages 5-6 and so forth...)

               If so, a script can

               a) pull up a found set of just the records or pages 1-4 on your layout 1.

               b) save them as a PDF

               c) change layouts and pull up the records for Layout 2 page 1

               d) save them as a PDF specfiying the same file path and name as b, but with the "append" option specified so that these pages are appended to the same PDF

               e) return to Layout 1 and pull up the records for pages 5, 6 in a found set

               d) save these as a PDF to the same filepath and also with the Append option specified

               f) continue this process as needed until report is complete.

               If you've never worked with $Path variables, you may find this thread on the topic helpful: Exploring the use of a $Path Variable in Scripts

          • 2. Re: Saving as PDF from two different layouts

                 I have two tables: PLACES and PERSONS. I need a report showing PLACES with PERSONS (portal). Most of PLACES have less than 8 persons and in this cases my layout fits one page. But I have three PLACES with more than 8 persons so there is a second layout which fits two pages.

                 I need to choose from all my PLACES only those in Poland and this found set needs to be in alphabetical order.

                 I made a script which founds all places in Poland, fits them into layout number on or two, and saves into oen PDF file. I wish to have a script working even if in the future I will add some places and the order will change. I tried to put a command  but it doesn't works. My idea of script is:

                 Find all PLACES in Poland

                 Go to layout 1

                 Save record 1 into file ...

                 If PLACES: Country = "Poland" 

                     Pause script

                     Go to layout 2

                     save to PDF/same file

                     return to script

                 Save record 3 into file ...


                 But I don't know if it works and how to do that.

            • 3. Re: Saving as PDF from two different layouts

                   What I outlined can do that, but now that you describe what you have in more detail, I think we can do better and much more simply:

                   I am assuming this relationship:

                   Persons-----<Places     (Though Persons----<Join>-----Places can also be made to work.)

                   If this is what you have, You can do the entire report from a layout based on Places.

                   The pages from Layout 1 can be replaced by a sub summary layout part when sorted by the Match field defined for this relationship in Places. You can put any fields that you want from Persons in this sub summary layout part and put the fields from Places that you need in the body below it.

                   You then perform a find or (Possibly) use go to related records (with Match Found Set option) to pull up the needed found set of Places records followed by sorting them by the "sorted by" field you specify for the sub summary part. (Sub Summary parts are invisible unless the current found set is sorted in a sort order that includes the part's specified break field.)

              • 4. Re: Saving as PDF from two different layouts

                     Only difference between my two layouts is the size of the portal.

                     Layout 1 is for 8 rows and fits one page.

                     Layout 2 is for 16 rows and fits two pages.

                     I have script which makes me a PDF with first pages and I only need to insert manually second pages in 3 cases. I wonder how to do it totally auto.

                     The best is to pause script, go to second layout, insert second pages and resume script. But I don't know which steps should be used to do this.

                • 5. Re: Saving as PDF from two different layouts

                       What I am describing does not use ANY portals as you go directly to a layout based on the portal's table in order to print the portal records.

                       The Invoices starter solutions for FileMaker 11, 12 and 13 all use this method for printing an invoice where the Line Items (Invoice Data) records that list the items sold on the invoice can be any number of records.