3 Replies Latest reply on Mar 1, 2012 9:15 PM by MicheleOlson

    Export 1-Many layout to multiple PDFs

    lkeyes

      Stumped again.

       

      I've got eight committees each with a several members.

       

      I have a layout showing a subgroup header of a committee name, and then a list of committee members and their offices.

      i.e, a classic 1-many layout.... (could be an invoice with line items, whatever...) (See attached screen shot)

       

      I've defined the subgroup to break after each change in the subgroup. It looks great as a layout.

       

       

      What I'm trying to do is to print these to PDFS, with a single pdf file for each committee.. So far I have the following script:

       

       

      Go to Record/Request/Page [First] Loop  Set Variable[$OutputFile; Value:Get (Desktopath) & "PDFFolder/" & Committee:: CommitteeName & ".pdf"  Save Records as PDF [Restore; No dialog; "$OutputFile"; Current record]  Go to Record/Request/Page[Next; Exit after last] End Loop

       

      This works fine, right now, creating a .PDF with the name of each committee... However, the PDF itself contains only the last member of each committee as a line item, and doesn't show the printed header line that has the committe name.

       

      Now if I change the red text, "Current Record", to show "Records Being Browsed", I get the correct output... that is 1 page per commitee, with a header and with the members showing, but it doesn't save to individual PDF files....that is I get 8 files (1 per committee), with the correct file name (the committee name), but all files have identical contents, an which is an 8 page PDF of all committees. 1 page per commitee.

       

      So, it is almost as if the "Current Record" parameter creates an additional loop that moves through the "many" records. (Good), but doesn't allow for interrupting to reset the file name (Bad).

       

      Should I do this from the data entry layout, with a portal, instead of the report layout?

       

      Is there any way to get there from here?

        • 1. Re: Export 1-Many layout to multiple PDFs
          lkeyes

          Unmunged Code

           

          Go to Record/Request/Page [First]

          Loop    

          Set Variable[$OutputFile; Value:Get (Desktopath) & "PDFFolder/" & Committee:: CommitteeName & ".pdf"    

          Save Records as PDF [Restore; No dialog; "$OutputFile"; Current record]    

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

          End Loop

          • 2. Re: Export 1-Many layout to multiple PDFs
            2ninerniner2

            If I am understaning correctly, after the first Save as PDF is made, you need to use the Append to existing PDF option after the Go to next record step.

             

            Go to Record/Request/Page [First]

            Loop    

            Set Variable[$OutputFile; Value:Get (Desktopath) & "PDFFolder/" & Committee:: CommitteeName & ".pdf"    

            Save Records as PDF [Restore; No dialog; "$OutputFile"; Current record]    

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

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

            End Loop

             

            Cheers!
            Lyle

            1 of 1 people found this helpful
            • 3. Re: Export 1-Many layout to multiple PDFs
              MicheleOlson

              Hi lkeyes,

               

              If I understand what you need to do, you want one PDF for each committee?

               

              What I'm trying to do is to print these to PDFS, with a single pdf file  for each committee.

               

              I don't believe you need the loop in your script. 

               

              I would write the script to find the first committee records on your report layout, sort in the order needed, then save records to pdf with the committee name. You can use the same technique you have above for saving the file to the desktop folder.

               

               

              Continue by finding each of the other committee records in turn and repeat the save to PDF process.

               

              You do need the setting to show records being browsed, otherwise it will only PDF a single record from the committee.

               

              HTH,

               

              Michele

              1 of 1 people found this helpful