May 24, 201312 yr I'm trying to export records from a constrained set into a CSV file. I have taken note that when exporting via a server script you have to export to the Documents folder on the server (or a temporary folder) so I use get(DocumentsPath) & "filename.csv" for the exporting the filename and path. When I run the script within the client it works perfectly. The exported document is placed in the documents folder. However, when I try to run it from the server no file is created. I have placed a send email command into the script which shows data from the last record in the found set and the email is sent correctly, so I know the set of records is constrained successfully. All of the script steps are compatible with a server script, and when the script is run from the server it does so without errors. Any suggestions of what I am overlooking? Thanks. Joe
May 24, 201312 yr Solution What path are you checking for the Documents folder? If you aren't already, it might be useful to include that in your diagnostic email. On a client, Get ( DocumentsPath ) returns the Documents folder for the current user logged-in to the OS. From the perspective of a server-executed script, there is no user logged-in to the OS, so it's less obvious where the documents folder is. I believe the default path is {applications or program files, as appropriate for the OS}/FileMaker/FileMaker Server/Data/Documents/
May 24, 201312 yr From the perspective of a server-executed script, there is no user logged-in to the OS, so it's less obvious where the documents folder is. I believe the default path is {applications or program files, as appropriate for the OS}/FileMaker/FileMaker Server/Data/Documents/ No, on the server, the get(documentspath) returns the "Documents" folder inside the FMS folder structure; it is not user dependent. Joe: in your post you don't have the "file:" or "filewin:" or "filemac:" prefix, I'm assuming you do have that in your script when you put the path together?
May 24, 201312 yr Author The problem has been solved. The script and the schedule was working perfectly. I was the error. After reading JBante's post, it lead me to figure the problem was where I was looking for the exported file. Because I was logged into the server, I was looking into the documents folder for that user on the server: /ServerHD/Users/serveradmin/Documents/SR-patients.csv As suggested, I put get(documentspath) into the test email and it showed: /ServerHD/Library/FileMaker Server/Data/Documents/SR-patients.csv Wim of course is correct in that get(documentspath) is not user dependent. Its just that the user didn't realize his documents folder was different that Filemaker's documents folder. Thank you both for your replies. Greatly appreciated!
May 24, 201312 yr No, on the server, the get(documentspath) returns the "Documents" folder inside the FMS folder structure; it is not user dependent. Is that not what I said?
May 27, 201312 yr We wrote a post here on FMF some time back on this entire process. A review of it might be helpful. It's posted in the Server Forum. Steven
Create an account or sign in to comment