5 Replies Latest reply on Oct 15, 2012 6:05 AM by mikebeargie

    FM Go 12: open document saved with Export Field Contents

    darrenburgess

      Per the FM Go 12 Development Guide, page 13, The Export Field Contents script step does the following:

       

      "By default, the files created by script steps appear in the Files on Device list and are saved in the Documents folder. "

       

      It turns out this documents folder is only accessible by the iOS application that saved the file, in this case FM GO. According to iTunes documentation ( http://support.apple.com/kb/HT4094 )

       

      Which leads to the question: How can FM GO open PDF files in its own documents directory on the iPad? Other applications can do this, such as Adobe Reader.

       

      Of course, one solution is to specify "Open Automatically" in the export field contents script step, then the document opens immediately (which may not be desired) in the iOS default pdf viewer (which happens to really stink, btw.)

       

      Darren Burgess

      www.mightydata.com

        • 1. Re: FM Go 12: open document saved with Export Field Contents
          mikebeargie

          Wouldn't you theoretically be able to do this by storing the export path and just having the option to launch that path later on with the iOS shortcut URLs for preview or adobe reader?

           

          $path = get(documentsPath) & "file.xls"

          Export field contents - $path

          GoTo layout "paths"

          new record

          set field paths:path - $path

           

          then a button application that somehow launches:

          "preview://" & paths::path

           

          Without plugins, I wouldn't see any way that filemaker afterwards could read-in paths.

           

          If you are using the export field contents script step anyways, a small transaction to store the path wouldn't be that hard.

          • 2. Re: FM Go 12: open document saved with Export Field Contents
            darrenburgess

            I presume that you are suggesting that using the Open URL script step may work by specifying the URL using the apps URL schema.  This however does not work, unless I have just missed the precise syntax.  I have tried several options. 

             

            "ibooks://" & $path

            "itms-books://" & $path

            "preview://" & $path

             

            and others.

             

            Interestingly enough, Open URL "ibooks://"  will open iBooks on the mobile device.  just will not open the document referenced by $path.

             

            You can also use the Get ( TemporaryPath ), however results are the same - document does not open.

             

            So far it appears the only solution is to use Export Field Contents ( Automatically Open ) to open the document in preview.  Preview then allows application to open in another compatible app, like iBooks or Adobe Reader for PDFs

             

            Darren Burgess

            www.mightydata.com

            • 3. Re: FM Go 12: open document saved with Export Field Contents
              mikebeargie

              ah, that's why I tossed in "theoretically". Have you tried running it through the webviewer, rather than OpenURL? Not sure what webviewer would do if you fed it one of those app URLs

               

              Another way (to try?) would be to import the stored path back in to a global storage container, then launch it there with goto field - select/perform.

              • 4. Re: FM Go 12: open document saved with Export Field Contents
                darrenburgess

                Yes, I can point the webviewer to the file by storing the path in a global variable and referencing that variable in the webviewer.

                 

                The Webviewer will then display a scrollable PDF.  It even provides a page indiation (ie 32 of 50), however no other interaction is possible (like zooming, page flipping, etc)

                 

                Could you elablorate on your second suggestion? ("import the stored path back...")

                • 5. Re: FM Go 12: open document saved with Export Field Contents
                  mikebeargie

                  Sure, you would have a "saved paths" table, same as I noted above, IE:

                   

                  $path = get(documentsPath) & "file.xls"

                  Export field contents - $path

                  GoTo layout "paths"

                  new record

                  set field paths::path - $path

                   

                  Then you would have an "open" button from the paths table, that would perform a script like:

                   

                  $path = paths::path

                  insert file into paths::global_container from $path

                  goTo field global_container - select/perform.

                   

                  So to review, export as you normally would to a static location, saving that path as a static string of text in a text field (one record per file exported). Then to reference/open that file later, grab the path, insert the file from that path into a globally stored container field, then goto that field and "perform" it, which launches whatever file you pulled back in.

                   

                  You could also error check file paths this way by checking the container size after the insert file script step, then dropping the whole thing in a looping script that validates paths in your paths table.