To automate a task in Filemaker, you create a script of course.
There is a script step called "import records" that you can include in a script to automatically import .csv data into your database.
The only obvious limitation, is that you will need to know the filename of your file at the time you create your script. If the filename is subject to change, then you'll have to rename your source file before the script can find it and import from it.
so maybe, where importTempFile is what you use in your Import Records script step, and newFile is the file you want to import your Filemaker Script should include:
Perform AppleScript ( do shell script "cat newFile > importTempFile" )
Import Records ( ... )
Or really the AppleScript should include steps to allow the user to choose which file they are importing, and the do shell script should only be one line in that AppleScript script.
If someone has a better way than the use of cat let me know. I'm green with bash.
I'm pretty new with FileMaker Pro could either of you provide a basic script or point me to a place where I can find examples of scripts to assist me in creating one similar to what has been suggested here. That would be a tremendous help. Thanks
If you are using windows, ignore the post that refers to AppleScript. That's a Mac OS only comment.
There is a single script step you can use, either platform:
Import Records [ Source: “file:Filename.fp7”; Target: “TableName”; Method: Add; Character Set: “Windows ANSI”;]
I suggest pulling up On Line help and reading up on this step to get the full understanding of it.
Basically, You put this step in your script and then click the specify buttons to tell the script where to find the source file, what format it is in, what target table will receive the data and what data will go in what field.
There are a lot of options, so study up on it before you try to use it.
would be very helpful if someone has sample code. I also have a second question based on the first jorom asked. After I imported data into table. I want script to check if the CaseID exist, if it does exist deleted CaseID (or whole row), if it doesn't append data into the table. Can someone show me how to write script for that. I'm a newbie to Filemaker. Thanks!