3 Replies Latest reply on Mar 8, 2010 5:27 PM by RickWhitelaw

    Naming a file during export.....

    paintboothguy

      Title

      Naming a file during export.....

      Post

      Hello All, 

      I have created a script that will save a PDF of a record to my server.  Can I also?:

       

      #1.  Have the script name the PDF file based on the contents of a field.  (ex:  if I run the script from the quotation layout, I would like the script to save the file and automatically name it CUSTOMER (based on the name in the customer field on that record) followed by the word Quotation. 

       

      #2.  Instead (or in addition) to saving the PDF file on my server, is it possible to have the script place a copy of the PDF in a container that I specify?

       

      Thanks,

      Andrew 

        • 1. Re: Naming a file during export.....
          TSGal

          paintboothguy:

           

          Thank you for your post.

           

          Yes, you can have the PDF file named based on the contents of a field.  Yes, you can also place a copy of the PDF file in a Container field.  You script would look something similar to the following:

           

          Set Variable [ $path ; "file:" & Get (TemporaryPath) & <Customer Field> & " Quotation.pdf" ]

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

          Insert File [ <Container field> ; "$path" ]

           

          That is, we set a variable ($path) equal to the the contents of the Customer Field, add Quotation.pdf to the end, and place that in the Temporary Path.  Then, we save the Current record to $path, and then go to the Container field and insert the file stored in $path.

           

          Let me know if you need clarification for any of the above steps.

           

          TSGal

          FileMaker, Inc.

          • 2. Re: Naming a file during export.....
            tex626

            Keep in mind if you are offering this to both platforms (Mac & PC), the path will vary slightly. You just need to substitute "filewin:" or "filemac:" for "file:" below after checking for OS.

             

            • 3. Re: Naming a file during export.....
              RickWhitelaw

              As far as I can tell, using "file:" works fine on both Windows and Mac. On Mac I can save the file correctly without even using "file:" . Another user here (who's on Windows) tells me that "file:" works fine but using nothing doesn't work.

               

              RW