2 Replies Latest reply on Jun 11, 2014 7:24 AM by Mike_Mitchell

    Opening PDF on Go using Open URL

    Mike_Mitchell

      Good day. I'm trying to do something that should be dirt-simple, and tripping up.

       

      Task: Create a PDF report and open it on iOS using Open URL.

       

      Strategy: Use the following script steps:

       

      Set Variable [ $path = Get ( DocumentsPath ) & {desired file name} & ".pdf" ]

      Save Records As PDF [ $path ]

      Open URL [ "file://" & $path ]

       

      Result: White screen with "Failed to open {filename}.pdf"

       

      I've tried using "file:/" instead of "file://"; just using the documents path; and nothing seems to work properly. The filename has no spaces or odd characters (just alphanumerics and underscores). The file is being created in the FileMaker Go directory; I can see it and open it after the operation is complete. Just won't open properly via the script.

       

      I know this is very basic and I'm doing something stupid. Can someone point out the error?

       

      TIA

       

      Mike

        • 1. Re: Opening PDF on Go using Open URL
          skywillmott

          Hi Mike,

           

          Would the following work for you:

           

          Set Variable [ $path = Get ( DocumentsPath ) & {desired file name} & ".pdf" ]

          Save Records As PDF [ Restore; No dialog; "$path"; Automatically open; Records being browsed ]

           

          It's the 'Automatically open' part that does the trick :-)

           

          You could also use Get ( TemporaryPath ) in the $path variable to not have it save into the visible file direcotry of FileMaker Go...

           

          cheers,

           

          Sky.

          • 2. Re: Opening PDF on Go using Open URL
            Mike_Mitchell

            Indeed it does. Duh.

             

            Which makes me think the Open URL is failing because of a timing problem (race condition). The PDF isn't finished writing before the Open URL fires off.

             

            Thanks for the help.