9 Replies Latest reply on Aug 9, 2013 7:42 PM by NicholasFernandez

    Can I drag and drop a file I want stored externally into a container field?

    NicholasFernandez

      Title

      Can I drag and drop a file I want stored externally into a container field?

      Post

           So, I think this is a yes or no question, but after a lot of research I can't find a definitive answer: Can I drag and drop a file I want stored externally into a container field?

           Currently, when I drag a PDF into my container field the file is embedded in the database. I've read that option-dragging creates this function in Bento, but I haven't had any luck in FMP (I'm using Filemaker Pro 12 on macs running Lion and Mountain Lion).

           Thanks for any help!

            

        • 1. Re: Can I drag and drop a file I want stored externally into a container field?
          philmodjunk

               Yes, you can drag and drop a file into the container field--whether it is externally stored or not.

               BUT, FileMaker has multiple insert methods. Drag and drop on FileMaker 12 is the equivalent of doing Insert Picture, not Insert PDF. Test the method and see if you lose any options you need for working with PDF's in a container field.

               Drag and Drop embeds the file the same as inserting into a container field from a menu option with the "Store a reference" option not selected. But for externally stored files, that is the option you want anyway.

          • 2. Re: Can I drag and drop a file I want stored externally into a container field?
            NicholasFernandez

                 Hi PhilMod,

                 thanks for the response. I'm actually trying to do a drag and drop "store as reference" addition to the record (with a PDF). Is this possible?

                 Also, why did you say I would want to embed the file? Am I missing something?

                 Thanks,

                 nick

            • 3. Re: Can I drag and drop a file I want stored externally into a container field?
              philmodjunk

                   You do not use "Store a reference" when you specify external storage for a container field. FileMaker transfers the file for you from the container field to the specified external storage location. (This is a new feature of FileMaker 12.)

                   Drag and drop does not give you the option to store a reference. It embeds the file. You'd need to script a process that exports the file to a desired location and then re-inserts it from that known location in order to get it stored as a reference automatically when you drag and drop into the container field. OnObjectModify can perform the script and this would also automate a process that can use Insert PDF when re-inserting the file, provided that you specify the "optimize for interactive content" option as the field's data format on the layout where your script inserts the PDF.

                   But it's an either - or proposition. Either you embed the file and use external storage or you insert a reference and don't use external storage.

              • 4. Re: Can I drag and drop a file I want stored externally into a container field?
                NicholasFernandez

                     Hi Philmod,

                      

                     I think you answered my question. 

                     I want the files to be reference so that they can be double-clicked in FMP to open. I assume that double clicking will not work with embeded files. (I haven't had any luck with it.)

                     The script sounds interesting, but would require the user to set up a location for the files to be stored if I want a different location for each database, corrrect?

                     Thanks for all of your help.

                     Nick

                • 5. Re: Can I drag and drop a file I want stored externally into a container field?
                  philmodjunk

                       Double clicking a container field works only when very specific criteria. This is true for both FIleMaker 11 and 12, but all of the new features added in 12 also disable the double click option.

                       In order to be able to open the file via double click in FileMaker 12:

                       1) The file must be inserted by reference.

                       2) The file must be inserted via the Insert File menu option (or the scripted equivalent) Insert Object files could also be opened like this in FileMaker 11 (and drag and drop inserted them as objects), but this is not a method supported in FileMaker 12.

                       3) The container field that you are double clicking cannot be "optimized for interactive content".

                       4) embedded files cannot be opened via a double click because the double click casuses FileMaker to send the file path to the operating system and prompts the OS to open the file with the corresponding default application for that file type. With embedded files, there's no filepath to send to the OS.

                       5) Since externally stored files are not "Store a reference" they can't be opened this way.

                       But you can write a script that opens the file with a single click via a script that uses Export Field Contents to export a copy of the file to your Temporary folder. This method will open all of your files with the default application no matter what options for insertion, data format or storage were specified.

                  • 6. Re: Can I drag and drop a file I want stored externally into a container field?
                    philmodjunk
                         

                              The script sounds interesting, but would require the user to set up a location for the files to be stored if I want a different location for each database, corrrect?

                         Somebody would have to specify a location for them. There are certain standard locations that are possible:

                         You can set it to store the files in the same folder as the database folder or in a folder located relative to it.

                         You can specify the desktop folder. (or an existing folder on the desktop)

                         You can specify the documents folder. (or an existing folder in the documents folder)

                         But FileMaker can't, just from FIleMaker scripting alone, create a new folder on the fly. Those have to either be set up by someone, created via a system script performed via the FileMaker script or made possible by adding one of the plug ins for FileMaker that add this capability.

                    • 7. Re: Can I drag and drop a file I want stored externally into a container field?
                      NicholasFernandez

                           Thanks Phil. 

                           Last question (I hope). Regarding your statement: 

                           

                      But you can write a script that opens the file with a single click via a script that uses Export Field Contents to export a copy of the file to your Temporary folder. This method will open all of your files with the default application no matter what options for insertion, data format or storage were specified.

                      Is this script an easy thing for you to talk me through? If so, I'd greatly appreciate it.

                           Nick

                      • 8. Re: Can I drag and drop a file I want stored externally into a container field?
                        philmodjunk

                             Set Variable [ $FileName ; value: //calculation to extract file name from container goes here ]
                             Set Variable [$Path ; value: Get ( TemporaryPath ) & $FileName ]
                             Export Field Contents [ YourTable::YourContainerField ; “$Path” ; automatically Open ]

                             See this thread for more on Filepaths, container fields, $Path variables and the script steps that can use them. In that thread, there's file you can download with a calculation field that extracts the filename from any container field regardless of the insertion method and/or storage options specified in  FileMaker 12 file. Use that calculation in the first set variable step in my example.

                        Exploring the use of a $Path Variable in Scripts

                        • 9. Re: Can I drag and drop a file I want stored externally into a container field?
                          NicholasFernandez

                               Sorry I didn't respond sooner. I want to get back on here to say thanks so much for all your help. I think this scripting might be beyond me at the moment, but I'll keep all this info in case I decide to delve deeper into FileMaker Pro. Thanks again!