4 Replies Latest reply on Apr 2, 2014 8:41 AM by jwshelton22

    Insert File not working correctly

    jwshelton22

      Title

      Insert File not working correctly

      Post

           Setting Variable $file as Get(DesktopPath) & Business::BusinessName & ".PDF" This is where pdf is saved and appended as the script progresses.

           The script does create the PDF and place it on the desktop.

           PDF file name displayed in container field is show in the attached jpg.

           I need to insert the file with only the Tree Health Management.pdf name in this case.

           My Insert file script step is not working. Will my variable not carry the

           Will always be on Windows.

           Help is appreciated.

           Jim

      Filename_Capture.JPG

        • 1. Re: Insert File not working correctly
          philmodjunk

                I can't tell exactly what your screen shot is intended to show. Is this a calculation field set up to show the file path text found in a container field or the actual container field?

               I'm not sure that I understand what you mean by:

               

                    I need to insert the file with only the Tree Health Management.pdf name in this case.

               Do you mean that you need to insert a copy of the file rather than a reference to it? This is an option that you select for the Insert File script step.

               Posting the actual script that you are using would also be helpful.

               To post a script to the forum:

                 
          1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
          2.      
          3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
          4.      
          5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
          6.      
          7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
          • 2. Re: Insert File not working correctly
            jwshelton22

                 The attached image shows both the script step to set the variable for the path and name and the insert file.

                  

                 thanks,

                 Jim

            • 3. Re: Insert File not working correctly
              philmodjunk

                   But is this all in one script or two scripts?

                   Do you get an error message when this script runs?

                   If this is two scripts, $file should be $$File to make it a global field that retains a value after the first script completes execution.

                   And I would just use:

                   Insert File [Business Clients RPT1::PDF ; $File]

                   rather than filewin:$File

                   Note in order for Insert File to successfully insert a a file into the field PDF, this field must be present on the current layout and accessible in Browse mode. Otherwise, the script step will fail to work. This is true of all script steps that start with "insert".

                    

              • 4. Re: Insert File not working correctly
                jwshelton22

                     Phil, thanks for you help.

                     I needed to go to layout that held the field, not just be in the same table.

                      

                     Jim