FM - Problems Exporting

Posted on 2011-09-30
Medium Priority
Last Modified: 2012-05-12
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
Question by:rvfowler2
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
LVL 25

Expert Comment

by:Will Loving
ID: 36893416
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 ) & "vacancy.tab" )

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 "vacancy.tab"
LVL 25

Expert Comment

by:Will Loving
ID: 36893486
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


Author Comment

ID: 36893815
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 vacancy.tab 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.

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 25

Expert Comment

by:Will Loving
ID: 36893936
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.
LVL 10

Accepted Solution

webwyzsystems earned 1000 total points
ID: 36907165
This might be helpful: a reference to filemakers support on this topic.



Author Comment

ID: 36911112
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:/export.tab, and the file running the script is /MyFiles/Library/Books.fp7, the exported file will be created as /MyFiles/Library/export.tab.

 •  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
LVL 25

Assisted Solution

by:Will Loving
Will Loving earned 1000 total points
ID: 36911305
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.

Author Closing Comment

ID: 36911571
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.

Author Comment

ID: 36911585
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.
LVL 25

Expert Comment

by:Will Loving
ID: 36911617
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.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question