4 Replies Latest reply on Feb 3, 2014 11:20 AM by beverly

    Setting the Temporary Path for Exporting PDFs from Container Fields

    nicholasfrese

      We have an application that exports PDF documents from container fields and then re-imports them when the user is finished working on them. Works great on the PC platform, but we are now adding several users who have iPads with Filemaker Go. How does one set the temporary path for import and export in that environment? Here is what we are using on the PC side:

       

      "filewin:" & Get (TemporaryPath ) & "(" & Materials::Catalog ID fk & ") " & Materials::Name & ".pdf"

       

      and for re-import:

       

      "imagewin:" & Get (TemporaryPath ) & "(" & Materials::Catalog ID fk & ") " & Materials::Name & ".pdf"

        • 1. Re: Setting the Temporary Path for Exporting PDFs from Container Fields
          mikebeargie

          According to the go development guide:

          https://fmhelp.filemaker.com/docs/13/en/fmgo13_development.pdf

           

          Page 13 states you can ditch the prefix, and just use Get(TemporaryPath) & etc...

           

          You still might be required to make other adjustments in how your script works to make it work fully with FMGo. That guide is a good reference on a lot of topics for Go vs. desktop FM development.

          • 2. Re: Setting the Temporary Path for Exporting PDFs from Container Fields
            mikebeargie

            also, you might need to add a "file:" prefix if you don't specify file:$path in your import/export dialogs.

            • 3. Re: Setting the Temporary Path for Exporting PDFs from Container Fields
              ninja

              Grabbed this from a previous post I made on a different forum...it's been working nicely for me.  I have not tested it on FMGo.

               

              Hope it helps...

              ++++++++++++++++++++++++++++

               

              OK,

              Finally got the rest of it sorted...it is now down to

              - one click open

              - from an externally stored (secure) container

              - allowing drag and drop into the container

              - without putting files on the desktop

              - and without the use of a global field.

              {All of these were mandatory for me...and bloody convenient too now that it's done!)

              For others who wrestle with the same thing, here's a way that works (remember that in FMP, there are typically multiple ways to do things):

               

              Create two fields in the same table as the container {Table::Filename} {Table::ContainerPath}

              Table::ContainerPath is an unstored calc, result text, whose value simply equals the container field...this traps your path for whatever file happens to be in the container at the time.

              Note that this path, when stored external secure, is "Remote:" and {the path}

              Set the container field to launch a script OnModify...the script is:

              SetField ( Table::Filename ; Let ([ L = Length( Table::ContainerPath) ; P = Position ( Table::ContainerPath; ":";1 ;1 )] ;Right(Table::ContainerPath ; L- P )  )

              // This strips off the "Remote:" from the front

              Now every time someone drags and drops into the container, Table::ContainerPath changes to the new path, and the OnModify trigger sets Table::Filename to the filename you want (including the file extension regardless of how long the extension is...can be 3 4 or 5 characters long these days)

              Opening the file is as Phil describes it above:

              Launch a script that goes:

              Set Variable [ $Path; Value: Get(TemporaryPath) & "/" & Table::Filename ]

              Export Field Contents [ Table::Container ; "$Path" ; Automatically open ]

              It seems weird to folks, but when the Export Field contents path dialog pops up, dont be afraid to simply type in $Path...

               

              Storing the file to your desktop works fine the first time, but then if you reopen the file you get a "Do you want to overwrite this file" dialog which requires a second click.  Storing it to Get(TemporaryPath) shoves the file in your temporary folder which allows the same file to be put there without opening the dialog.

               

              Hope this helps...there haven't been clear step by step instructions on single click opening of external secure containers yet, so I hope this will serve.

               

              Additional Note:  If you drop a file into a portal line container...the portal line container may not be ACTIVE, and if it not active the OnModify script will not launch to set your filename.  This is solved by adding an initial line in your "open my file" script to perform the "Set the Filename" script.

              Honestly, you could just have the opener script do it all and not worry about the OnModify trigger at all.

              • 4. Re: Setting the Temporary Path for Exporting PDFs from Container Fields
                beverly

                from another thread, here's my answer to the "path" issue (using documents directory, but I suppose you could use the temp directory instead:

                 

                ====

                I don't use  the desktop path , but the documents path with this formula:

                 

                /* WRITE path */

                // windows = "filewin:" & Get ( DocumentsPath ) & nameOfFile

                // mac = "filemac:" & Get ( DocumentsPath ) & nameOfFile

                // ios = nameOfFile

                 

                /* READ path */

                // windows = same as above

                // mac = same as above

                // ios = "file:" & Get ( DocumentsPath ) & nameOfFile

                 

                Notice that writing (save path) on the iOS only requires the filename and it's put in the documents. Reading (for attaching to email, for example, or with Open URL) requires the path. Or at least with FMP12. I haven't tested this in FMP13.

                ====

                 

                These work well for GO. Writing only needs the name of the file and it gets put into the "documents". Reading the file back (into container or attach to email) needs the "file:" and documents path and name of the file.

                 

                Beverly