9 Replies Latest reply on Feb 28, 2011 10:48 AM by philmodjunk

    Export multiple records as single pdfs

    cb

      Title

      Export multiple records as single pdfs

      Post

      hi guys, 

      I need a script to export multiple records as pdfs.

      I want to take the first entry from each record and use it as the filename for the pdf.

      I want it to automate without dialogues.

      So after the script runs I have a bunch of pdfs, all individually named, which represent a single record from my database.

      any help is greatly appreciated.

      thanks

        • 2. Re: Export multiple records as single pdfs
          cb

          Thanks for your swift reply.

          I've tried this so far.

          Loop
             Save records as PDF[//perform without dialogue; select current record option; title $field]
             Go To Record/Request/page [next ; Exit after last]
          End Loop

          I get a dialogue box every time.

          I want to create new pdfs but using the info in one of my fields as the file name.

          Where am I going wrong? 

          I am quite new to Filemaker. 

          thanks

          • 3. Re: Export multiple records as single pdfs
            cb

            Update:

            When I Specify a pdf, it overwrites it with different record info each time.

            It is changing the title field, I just need it to change the filename now, and to create more than one pdf.

            Thanks

            • 4. Re: Export multiple records as single pdfs
              philmodjunk

              Here's how I save a PDF to a filename specified in a field:

              Set Variable [$FilePath ; Value: "file:" & Get ( DesktopPath ) & Table::FieldName & ".PDF"]
              Save Records as PDF [Restore; no dialog; $FilePath ; current record]

              Note that $FilePath has both a file name and the location to where the file will be stored. In this example, the file is saved to the desktop. There are any number of expressions you can use to produce a valid filepath here, it depends on where you want the PDF to be stored and whether you are doing this on a Mac or Windows computer.

              The one thing FileMaker can't do by itself is create a new folder. Thus the filepath has to point to an existing folder. (There are Plug Ins you can acquire and use that enable a script to create a new folder.)

              • 5. Re: Export multiple records as single pdfs
                cb

                Thats perfect thank you so much

                • 6. Re: Export multiple records as single pdfs
                  cb

                  On more thing,

                  the following script

                  Set Variable [$FilePath ; Value: "file:" & Get ( DesktopPath ) & Table::FieldName & ".PDF"]
                  Save Records as PDF [Restore; no dialog; $FilePath ; current record]

                  needs you to input the table name each time is there a variable I can add to select the open/current document.

                  Thanks again

                  • 7. Re: Export multiple records as single pdfs
                    philmodjunk

                    What do you mean by "open/current document"?

                    Table::FieldName is a reference to the field where you store the file name.

                    You can use Get Field, to refer to the contents of a field indirectly if this file name is not always stored in the same field.

                    • 8. Re: Export multiple records as single pdfs
                      cb

                      Hi again, 

                      sorry for the confusion.

                      The previous script has to been changed for each document.

                      I was wondering if there was a variable I could put into this line

                      Table::FieldName

                      so that the script wil work on which ever document is open.

                      I receive many databases a day which need to be exported page by page and it would be handy to have a script that will work on whichever document is open rather than having to input the table and file name every time.

                      Cheers

                      • 9. Re: Export multiple records as single pdfs
                        philmodjunk

                        I receive many databases a day which need to be exported page by page and it would be handy to have a script that will work on whichever document is open rather than having to input the table and file name every time.

                        What a truly odd situation I'm trying to understand why on earth that kind of job would be necessary for so many different database files...

                        If these are files you see over and over again, can you get to the original file and create the script there? Then the next time you see this file, you just click a button and your job is done.

                        If the name of the database file is acceptable as the file name of the PDF, you might play with get ( FileName ) here--though you'll probably want to use a text function to extract just the name of the file without the fp7 file extension.

                        If you can't modify the original files, you're looking at constructing a total portal script--not easy to do in FileMaker that you can then import into each file so that you can run it to get your PDF's.