3 Replies Latest reply on May 25, 2013 10:20 AM by schamblee

    Save as PDF file name.



      Save as PDF file name.



           I searched different forums and was not able to find an answer about FN's behaviour when saving files as PDF.

           If file already exists, what happens?

           Does FM append a number to the file name (i.e. ../file.pdf found --> new: ../file1.pdf)?

           Does FM return an error code? If yes, which is the number to check in a loop script to increase a sort of "stamp-number"?

           Is there a script step command to check if the file already exists?

           All this because I make offers by means of a offer table related with a offer lines table and want to keep track of all the offers sent to customer (and requests sent to suppliers).


           Arnaldo Gaudenzi


        • 1. Re: Save as PDF file name.

               What I do when saving PDF's is use the Offernumber in the filename. A PDF that exists is overwritten.
               The filename I create is "OfferNumber" - "ClientName" .pdf.

               That way I end up with a bunch of PDF files like this:

               001 - John Johnson.pdf
               002 - Dave Davids.pdf

               I also have a damage part in my database where we make a report that shows the damage. This is a situation that always changes overtime and you want to keep a record of previous damage. So I add the date and the vehicle name to the filename. That way you only overwrite the file on the same day, but the next day, you get a new file. And so you get a whole log of previous pdf files.

               Vehicle 01 - 01-01-2013.pdf
               Vehicle 01 - 02-01-2013.pdf

               If you want to save every single PDF file you could add a timestamp so there is never any file overwritten. But that sounds quite extreme.

               I think for your offers using the offernumber as a filename is quite sufficient. You are always left with the most recent version.

          • 2. Re: Save as PDF file name.

                 Thanks for your reply.

                 My question was primarly made to know how FM acts in this case.

                 In fact my aim is to save as pdf a new version of the offer only if some data in the offer_table or in the related offer_lines_table has changed or if it was not saved as PDF after a change has been made and saved.

                 Thus, I think I'll define some fields (using Get ( RecordModificationCount ) in both tables to have a value in print_version that can be appended to the file name.

                 Or use the "extreme stamp" made with date and time which is, as I see it now, the quickest way.

                 Thanks again.

                 Arnaldo Gaudenzi

            • 3. Re: Save as PDF file name.

                   Note that save as pdf works a little different in filemaker go. 

                   From the filemaker go development guide :


                   By default, when you run the Save a Copy As, Save Records as PDF, or Export Field Contents script steps, FileMaker Go creates a new output file. If you continue running the script, a number is added to the end of each filename. For example, the first time you run the Save Records as PDF script step for a sample file, the output filename is sample.pdf. The second time you run the script, the filename will be sample 1.pdf.

                   To replace the output file with the new one instead of keeping multiple copies, add the file path (file:fileName or filemac:fileName) to the script. For example, if you type file:sample.pdf or filemac:sample.pdf in the Specify Output File dialog each time you run the script, the sample.pdf file in the Documents folder will be replaced with the new one.

                   The following example saves records as a PDF file named sample.pdf and will either create a new file or overwrite the existing file.

                   Save Records as PDF [No dialog; "sample.pdf"; Records being browsed]