FM - Problems Exporting

When I try to run a scheduled scriopt to export a .tab file, I get error 800 that it cannot save file to disk.  Yet, when I run it manually, I have no problem.  Any suggestions.  See screen prints. export1 export2
Who is Participating?
This might be helpful: a reference to filemakers support on this topic.

Will LovingPresidentCommented:
When doing an export with a script, the "Cannot save file to disk" error message is almost always caused by the export path being incorrect. I develop cross-platform so I use Set Variable [ $FilePath ] to create a path that works with either platform. For example:

Set Variable [
   $FilePath ;
   Value: Case( Abs( Get ( SystemPlatform ) ) = 1 ; "filemac:" ; "filewin:" ) & Get ( DesktopPath ) & "" )

Create a $FilePath variable like this or using your own path other than the Desktop and then set the Export Path to $FilePath instead of the hard-coded ""
Will LovingPresidentCommented:
Special Additional Tip for Mac Users who want to export to Excel when using Mac OS 10.7 (Lion).

Mac OS 10.7 (Lion) no longer supports the "Excel 95-2004 Workbook (.xls)" format because 10.7 no longer includes "Rosetta" support. It will only export to the newer "Excel Workbook (.xlsx)" format.  If you have a script that exports to this format that might someday run under Mac OS 10.7 or higher you will need to modify your scripts. Here's one approach:

Change the $FilePath calculation noted above to detect 10.7 or higher. A File path to save a "Profits Report" to the desktop might look like this:

Case( Abs( Get ( SystemPlatform ) ) = 1 ; "filemac:" ; "filewin:" ) & Get ( DesktopPath ) & "Profits Report"
&  Case( Abs( Get ( SystemPlatform ) ) = 1 and  Get ( SystemVersion ) = 10.7 ; ".xlsx" ; ".xls" )

Then, take your Export Records script step, duplicate it and change the export format to "Excel Workbook (.xlsx)" and add the following If Statement:

If [ Abs( Get ( SystemPlatform ) ) = 1 and  Get ( SystemVersion ) = 10.7 ]
  #Use newer .xlsx format for Mac OS 10.7 or higher
   Export Records [ No dialog; "$FilePath" ; Unicode (UTF-16) ] ]
  #Use older .xls format for all other situations
   Export Records [ No dialog; "$FilePath" ; Unicode (UTF-16) ] ]
End If

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

rvfowler2Author Commented:
Not sure how assiging it a variable will help.  Decided to put the export in its simplest form.  The below ran fine when run manually and saved to my C drive; however, when scheduled off the server, it did not save it and gave me an 800 error again.  Seems something is wrong with FM export when scheduled in the Windows environment.

Will LovingPresidentCommented:
Ah, you neglected to mention that this was being run as a server-side scheduled script which may very well make a difference. The 800 error is generated because: "You can get this error when you export field contents, and the app does not have write permissions to that directory."

Based on that I would check to make sure that FileMaker Server would be allowed to save to the c: drive on the server. If you stop FMS and open the files in FMPro on the server, does the script work properly? With FMS running can you open the files using Open Remote, trigger the script and have it run correctly?

You are correct that the script variable is not necessary, I just find it helpful since paths, for example to the desktop, are calculated while yours does not need to be.
rvfowler2Author Commented:
OK, so after reading web's help link (see relevant info below), am I correct in understanding that -- just like importing -- you can only export a file to the temporary or Documents folder?  What a limitation!!  I can work around this by doing a SendEvent a copying the file to the location I want, but it seems a ridiculous limitation.

 •  When using the Export Records script step or Import Records script step in a FileMaker Server scheduled script, keep the following in mind:

 •  Any specified file must be in the FileMaker Server Documents folder, the temporary folder, or a child folder of either the FileMaker Server Documents folder or the temporary folder. For example, the following are all valid paths for file.csv:

<Temporary Path>/file.csv
<Temporary Path>/Folder1/Folder2/Folder3/Folder4/file.csv
 •  Any path specified that isn’t a complete path to the file (for example, anything other than
/Library/FileMaker Server/Data/Documents/<0 or more directories>/<filename> ) is evaluated as being relative to the temporary path.

 •  Any paths that include “..” are considered invalid.

 •  For FileMaker Pro, if an absolute path is not specified in a script that will be executed from FileMaker Pro, the path is assumed to be relative to the location of the database file from which the script was run. For example, if a script containing the Export Records script step is run with the pathname file:/, and the file running the script is /MyFiles/Library/Books.fp7, the exported file will be created as /MyFiles/Library/

 •  If you are using a calculation that generates the file path for the XML file, you need to use the format used by the operating system for the the full path. For example, the following are valid paths if you are using calculations to generate the path for the XML file for Windows or Mac OS:

Mac OS: /Volumes/VolumeName/directoryName
Will LovingPresidentCommented:
The limitation applies only to Scheduled Server side scripts. I'm not sure why the limitation exists but I'm guessing there is a good reason, possibly related to server permissions which can be much more elaborate and finicky than on a regular workstation. Keep in mind that server-side scripts are an extension/add-on to FM Server's core functionality. FM Server is completely different from FMP where one has almost complete flexibility about where to save things to with an export.

So yes you will need to either do something to copy the file elsewhere or have whatever is picking it up know where to look in the allowable folders.
rvfowler2Author Commented:
Webz, thanks for the pointer toward the Help file; thought I had already checked that.  Will, thanks for the clarification as the Help isn't written as clearly.  I'll need to be careful about assuming server scheduled scripts can work the same as ones run from FMP, even if I do account for server compatible script steps and for the different location of the server.
rvfowler2Author Commented:
Note:  The limitation to importing and exporting only from the Documents folder is a real hindrance as I much prefer to do both processes once per day outside of normal business hours.  I can see why one could not save to just anywhere on the server, but not why one could not use scheduled scripts to save to another file server.
Will LovingPresidentCommented:
One thing you might try is creating a shortcut within one of the allowed folders to the actual location you want to save to. See if the scheduled script will permit you to save to the shortcut path and have the shortcut re-route the actual file to where you actually want it to go.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.