The ability to export (or import) in a scheduled script is severely limited. Only certain file types are supported (and filemaker isn't one of them) and only certain locations on the server (no external locations are possible) can be used as the location to which your records are exported.
Here's a link to a knowledgebase article on the subject: http://help.filemaker.com/app/answers/detail/a_id/7035/kw/server%20import%20records
Your alternative may be to use a FileMaker Robot file controlled by an OS based task scheduler utility to export your records. This functions like any other FileMaker client and thus avoids these limitations.
Thanks for the help, but I am very aware of the document you posted. I'm not running a varible script step and I have the correct path set to export the file to the local server as a tab file. I should at least be able to export to the local server. FMPro export works fine on the same machine.
To what file location are you exporting and how are you computing that file path?
This text in your original post suggests that you are attempting to export to a location that is not permitted in a server side script:
"-- this include export to a network resource, "
From that same article:
"Any specified file must be in the Documents folder, the temporary folder, or a child folder of either the Documents folder or the temporary folder."
These are directory paths local to the server. Exporting to an external location across the network is not permitted with a server scheduled script.
I've uploaded a screen shot of my path. The T drive is a local drive on this server.
That does not appear to be a location inside either the documents or temprorary items folders nor a child folder of either.
I think that if you use this approach:
Set Variable [$Path ; value: Get ( documentspath ) & "MPSDLUNCH"]
Then replace the above entry with $Path
This assumes that "MPSDLUNCH" is the file name.
Ok, I got it into my head that I can't export anywhere except to the FileMaker server document folders. It would be easier to export to network locations directly through the server. I don't understand the reasoning behind why the client can do this while the server can't.
Otherwise, I'm good on this question. Thanks for the help.
Can I get a reference on how to build a Filemaker Robot to move a file on my Filemaker server to a different network location.
I don't understand this limitation either. The limit to "local drives only" even applies to system scripts such as VBScript you might try to use with a system schedule to move files from a local drive across the network. Such scripts have to be invoked from an OS based Task Scheduler instead of the admin console before they will work.
Robot files are simple FileMaker files that have specific settings in File Options.
1) Set it to open itself with and account name and password that matches an account in the hosted file and which has the needed permissions for your script in that hosted file to run correctly.
2) Set it to run a simple script each time the file is opened:
Perform Script [//select script in the hosted file that does what you want]
Exit Application (Or possibly close file if you decide to leave FileMaker running on this machine)
You then use an OS based task scheduler such as Windows Scheduled Tasks to select this file to be "run" at the time of day you want it to run.
One caution: If your script in the hosted file should get trapped in an infinite loop, the robot file will start it up and then quit leaving this looping process running with no way to halt it short of using the admin console to close and re-open the file. Thus, you need to very carefully test your script before setting up to be performed by a robot file.
This limitation is stupid.
Even though I am able to move the files to the desired location with a Shellscript, I must be able to use $variables.
This is an old thread, and I wonder if FM Server still doesn't accept variables as file paths?
1 of 1 people found this helpful
If you click the link to the knowledge base article provided near the start of this discussion, you'll see that there have been no updates to it.
So what you are saying is that if I have files that need to be imported and exported, they must have the same name every time, if I want a server side script to take care of it?
FM does accept variables as the file path, has been for a long time now...
But it still can only import from / export to the temp folder or its own Documents folder. That is by design for security reasons and is not going to change any time soon I expect. That's not a big limitation though because you can use Script Sequence schedules and use OS-level scripting to move files in and out of the proper locations for the FM script (2nd part of the Script Sequence schedule) to work with.
Thanks for the answer Wim!
I understand the limitation of the Documents folder.
However, I'm afraid that FM Server with a server side script doesn't understand variables.
Ie; Would this work:
Set variable $filename ["The_File_12346.txt"]
Set Variable $filepath ["C:/Program Files/Filemaker/Filemaker Server/Data/Documents/" & $filename]
Export to $filepath
That won't work because the variable must be in 'FM speak' so it has to start with: