10 Replies Latest reply on Sep 28, 2016 6:49 AM by klawsure

    Append PDF in List View


      Hello - I have a layout in list view in which I have written a script that sorts and finds matching records based on a user name and saves them to PDF. However, I am using append to existing PDF and therefore each record is printed on a separate page. Is there any way to loop through each record so that the list view is preserved in he PDF?

        • 1. Re: Append PDF in List View

          I would figure out why the body part is page-breaking with each record.


          In layout mode, double click on "body" on the left side of the screen for the body part settings. There is a checkbox there that says "break before each occurrence", is that checked? if so uncheck it and retest.


          When you are in preview mode (ctrl/cmd + U) on that layout, does it look like a list or only one record?


          Do you possibly have fields or objects that overlap the body part boundaries that would cause it to break?


          Append to PDF will usually start with a new page, as PDFs don't save partial pages. So you need to figure this out in FileMaker itself.

          • 2. Re: Append PDF in List View

            Thanks Mike!


            I do not have it set to break before each occurrence, and there are no overlapping body part boundaries.


            It shows as a list in preview mode. If I save all records it saves as a list. If I manually find each user and save as PDF it saves as a list.


            The issue here, I think, is the append to existing pdf. It makes sense that each record would start on a new page.


            That being said, I am failing to see how to script this process properly.


            Here's the current script. If you or anyone else has any ideas it would be greatly appreciated!!!


            Go to Layout

            Show All Records
            Sort Records [ Keep records in sorted order ; Specified Sort Order: Reviewer Scores_All::Name_PM ; ascending]

            Go to Record/Request/Page [ First ]

            Find Matching Records [ Extend; Reviewer Scores_All::Name_PM ]


                 Set Variable [ $Scores; Value:Reviewer Scores_All::Name_PM & ".PDF" ]

                 Save Records as PDF [Restore; Append; No dialog; "Scores"; Current record]

                 Go to Record/Request/Page [ Next; Exit after last

            End Loop]

            • 3. Re: Append PDF in List View

              Why are you appending it to a PDF inside of a loop, rather than just appending the found set entirely at once?


              Like I said, if you’re appending each record, it’s probably page breaking each time through the loop as a result of that. You should export the PDF in its entirety at once.

              • 4. Re: Append PDF in List View

                I need each user to have a separate PDF of only their records. I have about 3,000 records, but only 150 users associated with these records. So, if one user has 240 records, I can't send them a 240 page PDF.


                I understand why the PDF is generating a page per record. I'm just missing the logic on how to achieve my goal.

                • 5. Re: Append PDF in List View

                  Just do a found set in the list view for that user’s records and export one PDF instead of looping through each record and appending it.


                  Or am I missing a reason you can’t do that?

                  • 6. Re: Append PDF in List View

                    I can find and export one user at a time, but I would have to do that over 100 times. I'm trying to automate the process.

                    • 7. Re: Append PDF in List View

                      You should be looping through a list of users then, not a list of records.


                      EG, if I needed a separate PDF for each user’s records generated to a folder, my script would look like this:


                      Go To Layout

                      Show All Records

                      Go To Record/Request/Page


                         Set Variable

                         Go To Layout

                         Perform Find


                            Set variable

                            Save Records as PDF

                         End If

                         Go To Layout

                         Go To Record/Request/Page

                      End Loop



                      This would generate a list of each user’s found “records” to a folder called “exportedPDFs” on my desktop. Each PDF would be the user’s ID, eg 1234.pdf, 1235.pdf. And it would not export the user’s PDF if there were no matching records.


                      No appends anywhere.

                      • 8. Re: Append PDF in List View

                        OK. I will try this. I'm somewhat unclear now on what layout, set variables, and find criteria I need to use, but I will try to reason through it.



                        • 9. Re: Append PDF in List View

                          It sounds like you are using the current record option with Save as PDF instead of Records Being Browsed.


                          A looping script that saves a PDF of the current record and then appends it to the previous PDF would produce the results described here: One record to a page.


                          Instead, pull up a found set of the records for one recipient and save as PDF a single time, but specify "records being browsed" not "current record"


                          No appending needed and much faster as well.

                          • 10. Re: Append PDF in List View

                            Thanks! I'm not sure if I changed the PDF record specification or not. This is what I ended up doing.