Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Trouble Exporting Records via Scheduled Server Script

Featured Replies

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

Solved by jbante

Go to solution

what error does the script generate?  It should be in the server event log.

  • 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/

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?

  • 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!

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?

Is that not what I said?

 

Yes it is; apologies!  I had misinterpreted your response.

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.