Is there a way to have Filemaker server on say a schedule import a CSV file? Any solutions that can detect a new file in a directory and import once detected?
Yes to the import. The "IMPORT" script step is supported on FMS. Keep in mind that FMS can only import from its Documents folder or the Temp folder. So you can't import from any other folder.
As to monitoring a folder no: not a 'live' monitoring. But you can have your schedule run every few minutes.
If you need an actual folder monitor that will kick into action as soon as a file drops into the folder then you'll have to build your own. FMS has an XML API that you can then trigger it to run a script to import that file. Or your tool can already parse the data and just push the data into FMS through the XML, PHP or xDBC APIs.
FMS can import file, but can not check to see if the file exists. You can have FMS run a script and put your files in the Document folder on FMS computer. Then try to import and trap for errors. There are several plugins that can be helpful for you. Otherwise, create a FM Robot that does the job for you. Easier to control then
If it's possible to have the file stored on a ftp server, I prefer to grab the text with insert from url and use a script to add the records and data. Using the ftp errors you can tell if the file doen’t exist. This method runs well on the server.
Hi - I have a script running on Filemaker 17 Server now that looks like this:
I'm trying to a similar one but not and "Update", just a straight Add. The issue I'm having is I forget how to map the fields. When you click the gear to set the settings and "Specify Import Order". the left side is blank (because the file is a variable). Can anyone refresh my memory on how to do it? Right now, the script deletes all records and never imports.
Grab or make an example file, and point the script to that (along with the variable reference). Then you can map your fields. When you are done, you can remove your test file reference.
Edit the script to add the "file reference" to a hard coded file. This allows you to set up the mapping. Place that on a line in the dialog (above or below - test each) the $variable/$$variable line.
Another simple option is to use JDBC. Using SQL INSERT INTO, you can easily add data to your FMS. Just a few lines of code. Totally independent. You could even schedule it in Windows scheduler or Mac Cron to run automatically if wanted. JDBC driver from FMP is free. Easy to use.
There are "tons" of online examples of how to use JDBC.
And, I've even written an introductory JDBC with FileMaker article right here on the forum:
Writing JDBC Code To Interact with FileMaker
Let me know if you have any questions.
This is very do-able, and can be done entirely server side. If you get a listing of a directory, you can automatically detect when there is a new file, then pick up the file path as a variable and import it. Depending on what version of FileMaker you are running, there may be native functions to use, or you can also use a plugin to handle parts of the scripting as well. I have one set up, using the base elements plugin, to get a listing of an S3 bucket in AWS, then copy down, unzip and import the contents of new files put there. Works very well.
Retrieving data ...