1 2 Previous Next 16 Replies Latest reply on Mar 28, 2014 10:05 AM by rgordon

    Get (DocumentsPath) on Go failing

    JStars

      Problem: Attaching a PDF to email on Go 12 fails.

       

      I have a client using Go 12 to connect to Server 12.

       

      I have a script that creates a PDF of a few records and saves it by setting a variable ($$DocsPath) with Get (DocumentsPath) & "Agreement.pdf."

      The next step is Save Records as PDF using Output File Path List as $$DocsPath

      Lastly is a Send Mail step with Attach file $$DocsPath.

       

      Everything works OK using the desktop client version in 12. When performing the script on the iPad, the email arrives, but without the attachment.

       

      Did something change in 12 for iOS that makes this fail?

       

      One other bit of info that might help: When I add a step that lets me view the PDF on the iPad, I get a blank document.

       

      Jonathan Stars

        • 1. Re: Get (DocumentsPath) on Go failing
          Stephen Huston

          iOS has no Documents folder to get the path for in Go, so the settings which work on a desktop don't work in Go.

           

          One needs to test for the Go application and, if running Go, set the $variable to something like this:

          "file:" & get ( temporarypath ) & "Agreement.pdf"

          • 2. Re: Get (DocumentsPath) on Go failing
            JStars

            Thanks, Stephen, but that doesn't do it. I tried both your way (with the word "file:" like you have it) and without the word "file:" It still didn't create any PDF.

             

            As a clarification, the old Get (DocumentsPath) does work with Server 11 and Go 11, and I can view the the PDF in the iOS. Anything else you can think of?

             

            I'm on iOS v6.1.2 on a Model: MC707LL/A

            • 3. Re: Get (DocumentsPath) on Go failing
              PSI

              Try "filemac:" and it should work...as long as the path is correctly delimited. Check it in the data viewer to be sure...

               

              John

              • 4. Re: Get (DocumentsPath) on Go failing
                JStars

                filemac might work on a Mac computer, but not on the iOS. Besides, it already works on a desktop machine, both Mac and Windows. It only fails on the iPad (and I assume iPhone, although we're not using that).

                 

                Jonathan

                • 5. Re: Get (DocumentsPath) on Go failing
                  steveromig

                  Have you looked on Page 14-15 of the FileMaker Go Development Guide?  Similar to what Stephen suggested but it might help:

                   

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

                   

                  Steve Romig

                  FileMaker, Inc.

                  • 6. Re: Get (DocumentsPath) on Go failing
                    beverly

                    Jonathan, I have found that Writing to Go documents does not need the "file:", but Reading from Go Documents does.

                     

                    I wrote this for my usage, the "path" for various access (including server) may or may not use each of the "Get()" paths, so read the documentation and test!! I put things in variables so that you can change as needed or use as needed. The filename and extension don't need to be "hard-coded", but only included here to show the final "path" that could be used.

                     

                    ====

                    Set Variable [ $filepath ;

                    Let (

                       [ $sysPlat = Abs ( Get ( SystemPlatform ) )

                       ; $plat = case ( $sysPlat = 2 ; "filewin:"

                          ; $sysPlat = 1 ; "filemac:"

                          ; $sysPlat = 3 ; ""

                          ; "file:"

                          ) // 1 = mac, 2 = win, 3 = iOS

                       ; $imgPlat = substitute ( $plat ; "file" ; "image" )

                       ; $desktop = Get ( DesktopPath )

                       ; $documents = if ( $sysPlat = 3 ; "" ; Get ( DocumentsPath ) )

                       ; $temp = Get ( TemporaryPath )

                       ; $fm = Get ( FileMakerPath )

                       ; $file = "literal" & table::field & "literal" // changeable

                       ; $ext = ".pdf" // can be .txt, .xls, .xml, .htm, etc.

                       /* iOS specific */

                       ; $WriteGo = $plat & $documents & $file & $ext

                       ; $ReadGo = "file:" & $documents & $file & $ext

                       /* results that seem to work most of the time */

                       ]; $plat & $documents & $file & $ext

                       // or $plat & $temp & $file & $ext

                       // or $imgPlat & $desktop & $file & $ext

                       // or $plat & $desktop & "Myfile_Copy" - such as the copy of an FM file.

                    )

                    ]

                    ====

                     

                    HTH,

                    Beverly

                    • 7. Re: Get (DocumentsPath) on Go failing
                      JStars

                      I've tried everything each of you have suggested and it still fails.

                       

                      Let me say again, this works fine with FileMaker Server 11 and Go 11.

                       

                      When I move to Server 12 and Go 12, it fails. No PDF is created. I also bypassed the script and went to the Print dialog. I chose PDF and then View. It takes me to the PDF viewer, but there's nothing there. If I choose Email, the Send button is dimmed because there's no PDF to send.

                       

                      It's the exact same iPad running Go 11 and 12.

                       

                      Is it possible there's some setting on the iPad that would do that? I'm using Version Go_iPad 12.0.6.

                       

                      Is there a known issue with that version?

                       

                      J **

                      • 8. Re: Get (DocumentsPath) on Go failing
                        odubov

                        Actually, Get (DocumentPath) is pointing to the root directory, where the local FM Go files is located.

                         

                        Alexey

                        • 9. Re: Get (DocumentsPath) on Go failing
                          rgordon

                          Jonathan, have you tried restarting the iPad. This issue has been documented in multiple forums and restarting the iPad seems to resolve the issue.  Unfortunately this issue can reappear and you will need to restart again. 

                          • 10. Re: Get (DocumentsPath) on Go failing
                            JStars

                            This absolutely fixed it! Thank you so much for following along. And thanks to everyone else who answered. You all presented some interesing options.

                             

                            J **

                            • 11. Re: Get (DocumentsPath) on Go failing
                              rgordon

                              FM Go has a few problems that can only be resolved through a restart.  Hopefully the next rev of FM GO will correct this.  I trap to see if the PDF is created before attaching it to the email.  If the PDF is not created, a  message is sent to the user that they need to restart their iPad.

                              • 12. Re: Get (DocumentsPath) on Go failing
                                JStars

                                How do you trap for that? It's not something I'm aware of. Is there an error number? This will give me a great way to help my users without making them go to a FAQ page.

                                 

                                J **

                                • 13. Re: Get (DocumentsPath) on Go failing
                                  beverly

                                  I have two Send Mail inside an IF. One with attachment one without.

                                  But I have a clarification question on 'restart'. Do you mean:

                                   

                                  Close that db & reopen

                                  Close FMGo (swipe off) & reopen db

                                  Put iPad to sleep & reopen db

                                  Shut iPad OFF, turn on, reopen db

                                   

                                   

                                  • 14. Re: Get (DocumentsPath) on Go failing
                                    rgordon

                                    Bev, unfortunately FM GO is like a misbehaving toddler.  Sometimes it needs a slight correction by restarting the App but other times it needs a major correction by restarting the iPad.  This works fine until FMGO decides to throw its next tantrum. 

                                     

                                    Jonathan,there are probably multiple ways to check for the PDF.  I do it by viewing the PDF in a web viewer and then scrapping the contents of the viewer.  A blank web viewer will return some contents so I use something like if the contents length is less than 100, there is not a PDF.  Btw, the web viewer has to be on the active window, it can not be in the gray area on the right.

                                     

                                    Initially I thought the best way would be to insert the PDF into a container and check to see if the container is empty.  Unfortunately it doesn't appear you can not suppress the error message to find the PDF for the insert if it doesn't exist.  Set Error Capture On doesn't work.

                                    1 2 Previous Next