5 Replies Latest reply on Sep 1, 2010 10:31 AM by goodone

    Automating Import

    jorom

      Title

      Automating Import

      Post

      Hello,

       

      I am wondering if there is a way to automate an import into FileMaker Pro from a.csv file. I have about 10 columns with varying amounts of records each time that come in once a day. Is there a way to set up an automatic import? If anyone can offer any suggestions or help I'd greatly aprreciate it. 

        • 1. Re: Automating Import
          philmodjunk
            

          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.

           

          • 2. Re: Automating Import
            obeechi
              

            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.  

            • 3. Re: Automating Import
              jorom
                 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
              • 4. Re: Automating Import
                philmodjunk
                  

                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.

                 

                 

                 

                • 5. Re: Automating Import
                  goodone

                  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!