7 Replies Latest reply on Jul 3, 2017 8:51 PM by user19752

    How to open a pdf file inside a storage field


      Hello all,


      I have a big selection of pdf files that I want to categorize using keywords and other fields. I also want to store them in my google drive folder.


      So I created a FM file in my Google Drive folder with a storage field, and I dropped the pdf inside. Everything works great (I can preview the document and the file is copied inside my google drive folder) but I cannot open the file from inside FM. I can see all the pages, search, even print but to actually open it I have to go to the specific folder and search for the file. Is there any way to double click on the preview and open the document in Preview / Reader etc? I guess that it is easy to do but I can't find how...


      Thank you all in advance.

        • 1. Re: How to open a pdf file inside a storage field



          Export Field Contents could be useful.

          Define a variable $Path as Get ( TemporaryPath ) & "SomeFileName.pdf"

          Then export from the PDF container to $Path and specify to open to document.




          "There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies." — C.A.R. Hoare, The 1980 ACM Turing Award Lecture

          1 of 1 people found this helpful
          • 2. Re: How to open a pdf file inside a storage field

            When I read your question my thought is that you need some code to link it with FileMaker. Your google drive is actually stored on your desktop. Not in the cloud. If it is on your desktop then why not create a container in FileMaker specifying external storage. FileMaker should see it just as another folder.



            • 3. Re: How to open a pdf file inside a storage field

              Here's some interesting info:

              This is from a referenced PDF file in Google Drive:

              The first is the typcial display when you show the PDF Container Field in list view.

              The Second is using a Menu Bar Button and in the text area with the pencil where you enter a title for the button I used the Container Field instead. The black area below shows how the filepath is displayed.

              The third is a calculated field using getcontainerattributes(PDFFIELD;"All")


              Unfortunately while FileMaker stores the filepath for referenced files it does not in this instance let us access that. This is typical... Hopefully they have added that and I just don't know where to get it.


              PDF Container Attributes.PNG




              If you use one of a several plugins you can get the referenced path when you insert it into the container field. I think Troi and Monkeybread do this. I know I used somebody's plugin to do this a year or two ago. I think I may have been able to get the two file paths shown above using a plugin.


              YOu can also use GetDirectory to locate a folder and save its path into a field or variable. But plugins offer more power when it comes to getting filenames inside folders.


              Get ( DocumentsPathListing ) is a nasty little thing that can be used to grab the paths and names of all of the documents in your documents folder. Unfortunately a shortcut of a folder in a cloud folder doesn't work very well here.

              • 4. Re: How to open a pdf file inside a storage field

                From what I can tell you are in the cloud not actually on the Mac. Maybe one of the plugins would solve the problem. If not then create a folder on your real desktop  and have FileMaker access it. Set the folder to back up to Google Drive. Be glad to learn if I am not see something.


                • 5. Re: How to open a pdf file inside a storage field

                  Are you on a Mac or Windows computer? I haven't used Google Drive, but does it sync files like DropBox where there is a sync folder on your computer and a matching folder in the cloud? Also, if I understand your question, files in Google Drive are available, but you can't see the files in your FMP database.


                  First, you shouldn't host databases in a sync directory list Google Drive, DropBox, etc.. You will run into trouble at some point where the data will break or worse.


                  In a number of our solutions, the client has a DropBox folder set up for all manner of files (documents, spreadsheets, etc.). We then create a path in the database (ours are hosted with FileMaker Server, but it could be a local file). Then just Export Field Contents (container field). Set to Open would automatically open the file in the appropriate program. Alternatively, we leverage the path and the filename to automatically open the document in Preview. I think this would be more to your liking since you would have the filename with the associated key words, etc. When setting a path to open the document, I would recommend using the computers TemporaryDirectory so the desktop doesn't become cluttered and the files are automatically cleaned up when the user logs off the computer.



                  • 6. Re: How to open a pdf file inside a storage field

                    Back to the original question:


                    I think you are saying you have PDF files stored inside your Filemaker container and want to save that file you a folder in your Google drive. Now you want to open the files in the Google Drive folder using a FileMaker script/button.


                    Since you can't depend upon your Google Drive files matching where you first put them. the safest bet is to open the file that is inside the container.


                    If you want to open the exported file for editing and modifying, you might check several plugins one from MBS and one I think it is called Script that enable editing of the data in the PDF while it is in the container field.

                    • 7. Re: How to open a pdf file inside a storage field

                      You can get reference with

                      GetContainerAttribute ( container ; "externalFiles" )