Jump to content

Export Records Confusion

Recommended Posts


I am running a database on FMS18. I want to export a found set of records to an .xlsx file. I know that databases on a server export files to the server's Documents folder, or any child directories of it. The problem is, I can't access the file after it is created!

The script sets a variable $filepath  to Get(DocumentsPath) & "TestFolder/TestExcel.xlsx". It then sets a field  to $filepath so I can see where it went. The trouble is, the field shows the local (FMPA) Documents path instead of the server's. The file was not saved in the local TestFolder, but I can't prove that it was saved in the server TestFolder.

If I run the script locally, the same indications are seen, but the file has been saved locally. 

Running the script as a subscript wrapped in a Perform Script on Server script or running it as a scheduled script on the server produce the same results (presumably saving the file on the server, but reporting the path to it as the local path). 

Get(DocumentsPathListing) misbehaves in the same manner.

The server is at a hosting service so I have limited access to it.

The next hurdle will be attaching the file to an email. My attempts so far indicate that this again works fine on a local file, but there seems to be no way to perform this operation on a served file. Can anyone confirm this is true, and does the client have permissions to access the file using PHP to workaround the email attachment question?

Share this post

Link to post
Share on other sites

You need to perform these operations within a client that has the hosted database open as a guest.

Either that or have FmServer sent the email, using Send Email using SMTP Server option.  Server, executing the script in its own space, should be able to reference a file that it exported to its own documents folder, and attach it to an email that it, itself, is sending.


The client (and/or the environment you're in on your own computer) has no business accessing the FileMaker Server box's Documents folder.  If you can get to it, something's wrong.




Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use