5 Replies Latest reply on Dec 5, 2015 10:50 PM by mwpv11

    Need help with Dynamic named .pdf

    mwpv11

      I'm trying to export and print a records within a layout as as PDF.  But, I want the exported PDFs to be dynamically named after each 'Campus' and 'Teacher'.

       

      I also want the script to run and export a new PDF for each teacher (there's 82).

       

      I've found a script online (see below) and it works ok; but, the problem is that it will generate one PDF with all of the found records and their layouts inside.

       

      https://www.youtube.com/watch?v=f1SeBAHaf0Y

       

      What I need to do is have Filemaker generate a PDF for each found record and name it dynamically.

        • 1. Re: Need help with Dynamic named .pdf
          taylorsharpe

          The script step is called "Save Records as PDF []".  There is an option in this script step to Specify the Output File.  You will want to use a variable such as $Path.  So you look through the PDF's you want to export and change the $Path name for each one you are exporting and assuming you have a field called Serial or anything else unique to the export, you do something like $Path = Get ( DocumentsPath) & "File_no_" & $Serial & ".pdf 

          • 2. Re: Need help with Dynamic named .pdf
            keywords

            Re: "it will generate one PDF with all of the found records and their layouts inside"

             

            I haven't looked at the script, but if its product is as you suggest, then to overcome this you possible need a looping script that steps through record by record making sure the Save as PDF step is set to Current Record, and not Records being browsed, which is the default setting.

            Screen Shot 2015-11-30 at 7.57.03 pm.png

            • 3. Re: Need help with Dynamic named .pdf
              mwpv11

              Hi Taylor,

              Thank you for the information about my script. I was away for a few days

              and just got to look at your response today. I have one question being new

              to this sort of thing. Here's my script...could you tell me when I would

              need to put the 'loop' you're referring to below?

               

               

               

              Set Variable [$path; Value: //PATH

              'filewin:/C:/Users/tmills/Desktop/CTF_ReportCards/" & //Name

              new_list_of_CTFs::CTR1...]

              Go to Related Record [Show only related records; From table:

              "new_list_of_CTFs"; Using layout:

              • 4. Re: Need help with Dynamic named .pdf
                taylorsharpe

                mwpv11 wrote:

                 

                Hi Taylor,

                Thank you for the information about my script. I was away for a few days

                and just got to look at your response today. I have one question being new

                to this sort of thing. Here's my script...could you tell me when I would

                need to put the 'loop' you're referring to below?

                 

                 

                 

                Set Variable [$path; Value: //PATH

                'filewin:/C:/Users/tmills/Desktop/CTF_ReportCards/" & //Name

                new_list_of_CTFs::CTR1...]

                Go to Related Record [Show only related records; From table:

                "new_list_of_CTFs"; Using layout:

                 

                Enter Find

                Set Field(s)....

                Set Error Capture (on)

                Perform Find

                Set Error Capture (off)

                If ( Get ( FoundCount ) = 0

                     Exit Script

                End If

                Loop

                     Set Variable [$path; Value: //PATH

                     'filewin:/C:/Users/tmills/Desktop/CTF_ReportCards/" & //Name new_list_of_CTFs::CTR1...]

                     Set Error Capture ( On )

                     Go to Related Record [Show only related records; From table: "new_list_of_CTFs"; Using layout:

                     Set Error Capture ( Off )

                     If ( Get ( FoundCount ) > 0

                          Export As PDF ( $path )

                     End If

                     Go to Layout ( Original )

                     Go to Record Request ( Next , Exit on Last )

                End Loop

                 

                 

                That's a start at least.  Hope it helps. 

                • 5. Re: Need help with Dynamic named .pdf
                  mwpv11

                  Thanks a bunch, I'll try it. I'll let you know if it works.