May 23, 20205 yr I have a Script that uses "Export Records" to export a file to the following path: file:../../../../Desktop/OUTPUT/Untitled.tab How do I get 'Untitled' replaced by the contents of a field in my Table?
May 23, 20205 yr Set a variable to: Get (DesktopPath) & "OUTPUT/" & YourTable::YourField & ".tab" then use this variable as the output file path in the Export Records > Specify output file dialog.
May 23, 20205 yr Author Thank you, comment. I used the "set variable" as follows, and created the following script: The script runs but gave the following error. The filename is valid (I checked by copying a file into OUTPUT and changing its name to match the value of the variable). Please can you advise what I have done wrong!! (Please ignore any image below here, saying ".tab". I have tried to delete it, but it keeps reappearing!! Edited May 23, 20205 yr by philipcaplan extra image was included, had to be deleted
May 23, 20205 yr Then I don't know. I've made a simple test file that works for me. See if it works for you, so that we can tell if it's something in your file or in your system. ExportTest.fmp12 Edited May 23, 20205 yr by comment
May 23, 20205 yr Author I have run your test script, and it works. I tried copying-and-pasting from your script into a new script in my FMPro as follows: but I still got a failed result. Any other thoughts?
May 23, 20205 yr Not really. I am ignoring your last attempt, which is obviously wrong (there shouldn't be any escaped quotes in the filepath calculation). The only thing that comes to mind is that your field contains an invalid filename. I am not able to verify this through a screenshot, but perhaps there are some invisible characters?
May 23, 20205 yr Author I thought that maybe it is the filename that is causing the problem, so I tried using a different field in my table whose content was just PS501 but it didn't help. I got: "PS501.txt" could not be created on this disk etctetc. But if I changed $filePath to xxxfilePath in the Export Records script step, the file got created with filename xxxfilePath. Unfortunately, that's not QUITE what I need!!!! Perhaps I'll have to write the files that way by script, and then rename them by hand! A temporary solution, but not very useful! BTW the extra images are ones I tried to delete. "edit" seems to allow me to edit my message shortly after hitting "Submit Reply" but when the message reappears the deleted image is not deleted!!!!!
May 23, 20205 yr Can you post a copy of your file, reduced to the minimum necessary to show the problem?
May 23, 20205 yr Author Here is the entire file, all 328kb of it before zipping to 83kb..... PSEFER.fmp12.zip
May 23, 20205 yr You have this as the output file path: file:../../../../Desktop/OUTPUT/$filePath You should have only: file:$filePath or: $filePath The path to the desktop and the OUTPUT folder is already included in the $filePath variable (use Show Custom Dialog to see its exact contents).
Create an account or sign in to comment