13 Replies Latest reply on Jul 29, 2017 7:57 AM by philmodjunk

    Drag and Drop Files into Container Fields?



      Drag and Drop Files into Container Fields?




      Is there any way to drag and drop files (i.e. .pdf and .doc files) into a container field?


      A related question.. is there a way to 'double click' on a .doc or .pdf file in a container field to open? (Instead of having to right click and "Export Field Contents").


      Thanks in advance... 

        • 1. Re: Drag and Drop Files into Container Fields?

          Don't know of a way to drag an object from outside filemaker and drop it into a container field :smileysad:


          If you store the file in the container "by reference" you can then open the file by double-clicking the container field.


          If you must have the file physically stored in the container you can script the export field contents process. You can even make your container field the "button" that you click to trigger the script.

          • 2. Re: Drag and Drop Files into Container Fields?

            Great, thanks Phil! Too bad about the drag and drop... that would be really handy in cases where someone sends you an attachment (i.e. resume) that you want to add to a record.


            Would you mind giving me a step by step on making a container a button? That would be way easier than having to save to a folder/desktop before opening!



            • 3. Re: Drag and Drop Files into Container Fields?

              Simply select the field while in layout mode and select Format | Button Setup... and you can treat a field just like a button. Be aware that this button setup will keep you from clicking on the field and using Insert to insert the file in the first place. You'll need a separate layout for inserting files or you should place a button next to the container field and use it to open the file.

              • 4. Re: Drag and Drop Files into Container Fields?

                Thanks Phil,


                Yes, we'll need to be able to insert files, maybe the button beside the container field would be the way to go.


                Could you outline the script that I'd have to associate to the button, to open the file? 

                • 5. Re: Drag and Drop Files into Container Fields?

                  Fenton Jones posted an excellent script for this which I've modified to make it applicable to all file types:


                  Allow User Abort [Off] 

                  Set Variable [ $filepath; Value:  Case ( Abs ( Get ( SystemPlatform )) = 1; "filemac:"; "filewin:" ) & Get ( TemporaryPath ) & GetasText(Table::Container Field) ]

                  Export Field Contents [ table::container field; $filepath; Automatically open ]

                  Pause/resume Script [ Duration (seconds); 1 ] 

                  Export Field Contents [ $filepath ]


                  The second export field contents step is supposed to delete the newly created file. I've found that it deletes the file if I specify a folder on my desktop but for some reason it didn't delete it from the Temporary folder. It's still an excellent way to pop open a file that isn't stored by reference.

                  • 6. Re: Drag and Drop Files into Container Fields?
                       Fantastic, thanks.
                    • 7. Re: Drag and Drop Files into Container Fields?

                      That's weird - I didn't expect it to work, but I just dragged a jpeg from my desktop and plonked it into a container field, and it worked perfectly - even replacing the existing document that was already there.  (Without warning, be that good or bad.)  I was curious whether it had defaulted to a stored copy, or a reference only, so I double-clicked it and it showed me the full path name to the document on my desktop, inferring to me that it was 'by reference only'.  So I changed the document name on my desktop and double clicked the container field again.  It showed me the same (original) document name and location... and opened it anyway.  So I have to assume that the full path-name is only a reminder of where it was sourced from, but it is in fact now copied into the container field.


                      By the way, from my experience storing the documents inside a FM field will explode the file size very quickly, to the point where I've never seen it actually be manageable, but I really appreciate the 'Store as reference' feature.



                      PS: I was inspired to even try it because I used the FM Graphics pack, and you can use it the opposite way - have the file you're designing in Layout mode, and the Graphics File in browse mode.  Just drag the browse-mode Graphics File container field on to the layout you're designing, and there it is.  No copy-and-paste needed.

                      • 8. Re: Drag and Drop Files into Container Fields?

                        I agree that's weird. I thought I'd been told elsewheres that drag and drop into container fields wouldn't work from outside Filemaker. Even weirder is that If I use insert document, I can't double click the container field to open it. If I drag and drop, I can. The file is definitely copied to the field as edits made to the original don't show when you open the container's copy by double-clicking.


                        Just did a little more checking before posting. Apparently, drag and drop performs an Insert Object operation. If you use insert object to store a file in a container, you get a copy stored in the container and it can be opened via double clicking the file. If you use Insert File, you can choose either by reference or to store a copy. If you store a copy, however, you can't open the file by double-clicking the field. You have to export the field contents instead.

                        • 9. Re: Drag and Drop Files into Container Fields?

                          Umm, it's been a while, but I was helping a Library District on an Assets database, primarily photographs.

                          I set up a series of fields Platform, ServerField, HDField, FolderField01, FolderField02, FolderField03, Filename+extension.

                           A calculation field was used to concantenate.

                          This is from memory, not exactly accurate.

                          The platform was found by Filemaker, the Filename was extracted from  a referenced import 

                          The idea was to allow the data to be moved from server or harddrive or folder and allow a replace command to update all the referenced documents. Win and Mac, photos, movies, pdfs, docs, and other file types were tested. 

                          It worked really well. 


                          • 10. Re: Drag and Drop Files into Container Fields?

                            Humpf, just been having a similar problem too.


                            I have lots of PDFs to add to a medical database - we scan different parts of the notes seperately eg referral letter, clinical notes, operation notes and anaesthetic charts.


                            What I have been doing when scanning the seperate parts is to use the hospital number with what the document is as the file name eg XX123456_referrral_letter.pdf

                            XX123456_clinical_notes.pdf  etc


                            What I was thinking of doing is having a folder system on the server eg


                            Server\PDFS\referral letters

                            Server\PDFS\clinical notes

                            Server\PDFS\anaesthetic charts etc


                            What I then thought was that with some smart calculations i could dump the PDFs in the correct folder then they would appear in the database.....


                            This is slightly complicated by the fact that there is more than 1 hospital number for each patient in a seperate (related table) - HOSPITAL NUMBERS::Hospital number and HOSPITAL NUMBERS::Hospital


                            So, the calculation would need to take this into account too....  Also I thought if there wasn't a file there for that container with the specific filename a boolean calculation could then display a graphic that  says "Sorry there is no PDF available".  Eeek this is getting really complex! 


                            My head is hurting...


                            The issue I have is that there are a lot of PDFs to add to the database (thousands) adding them manually is going to take a long time even with some smart layouts!


                            When I drag and drop them into the container field they are embedded/loaded into the database rather than just linked; again this is taking a lot of time and is making the database huge - some of the PDFs are quite large - up to 90mb each - in fact there is over 2gb of PDFs to add into the database.  What seems to be happening when FMP save the file within the database there is an exponential growth of the datbase filesize eg if i add 100mb of files the database increases more than 100mb (seems more like 300mb).


                            I am not sure where to go with this.... any suggestions??






                            • 11. Re: Drag and Drop Files into Container Fields?

                              Hello I am Bill

                              I am fooling with a File Maker program right now.

                              I plan to have an Apple script enter each pdf I place in an action folder, into filemaker automatically. By turning the folder I place the files into, into an action folder or "actions enabled" folder. It will move them to a final resting place and enter them into Filemaker.

                              The pdf's will link into a Quicktime container field. So that you can quickly and instantly look at multi page pdf's, using the arrow keys at the bottom of the Quicktime container field. If I ever need to print or look at the document in its original form, through Adobe Acrobat, I can just export the Quicktime Container link, and have it open automatically in Acrobat. And the original pdf that is moved and or renamed will show up in Adobe Acrobat.

                              This is the only link I could find with my home search engine, if I get a chance I will search for the Filemaker Apple Script link tomorrow at work. I find I get two totally different search results. One on the home Windows machine and the other on the Mac at work. Strange if you ask me. And it is not like one is better then the other. They just find two similar but totally different sets of information.



                              I have found things at home that I could not find at work and visa-versa.


                                                               William McCormick

                              • 12. Re: Drag and Drop Files into Container Fields?

                                You can drop PDF and doc files into a container field with no problems in more recent versions of FM

                                • 13. Re: Drag and Drop Files into Container Fields?

                                  And in recent versions, Insert Object, does not exist.