Solved

FM - Problems Exporting

Posted on 2011-09-30
10
510 Views
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
0
Comment
Question by:rvfowler2
  • 5
  • 4
10 Comments
 
LVL 24

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"
0
 
LVL 24

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) ] ]
Else
  #Use older .xls format for all other situations
   Export Records [ No dialog; "$FilePath" ; Unicode (UTF-16) ] ]
End If

0
 
LVL 2

Author Comment

by:rvfowler2
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.

filewin:/c:/vacancy.tab
0
 
LVL 24

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.
0
 
LVL 10

Accepted Solution

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

http://www.filemaker.com/11help/html/scripts_ref1.36.69.html


0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 2

Author Comment

by:rvfowler2
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.

Notes
 •  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:

<Documents>/file.csv
<Temporary Path>/file.csv
<Documents>/Folder1/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
0
 
LVL 24

Assisted Solution

by:Will Loving
Will Loving earned 250 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.
0
 
LVL 2

Author Closing Comment

by:rvfowler2
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.
0
 
LVL 2

Author Comment

by:rvfowler2
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.
0
 
LVL 24

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.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now