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"
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
Try "filemac:" and it should work...as long as the path is correctly delimited. Check it in the data viewer to be sure...
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).
Have you looked on Page 14-15 of the FileMaker Go Development Guide? Similar to what Stephen suggested but it might help:
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 ;
[ $sysPlat = Abs ( Get ( SystemPlatform ) )
; $plat = case ( $sysPlat = 2 ; "filewin:"
; $sysPlat = 1 ; "filemac:"
; $sysPlat = 3 ; ""
) // 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.
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?
Actually, Get (DocumentPath) is pointing to the root directory, where the local FM Go files is located.
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.
This absolutely fixed it! Thank you so much for following along. And thanks to everyone else who answered. You all presented some interesing options.
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.
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.
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
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.