3 Replies Latest reply on Mar 1, 2013 10:50 AM by philmodjunk

    Importing directory of files into separate tables



      Importing directory of files into separate tables


           I'm new to FMP 12. I tried to import a directory of CSV files which represent different tables in a database. FMP imported the data from all the files into one table. How can I import the data from these files into separate tables?

        • 1. Re: Importing directory of files into separate tables

               Are you using Import Records | File or Import Records | Folder? To import the data into different tables, you'll need to use the File option.

               This can be scripted.

               How do you determine that a given file is intended for import into a specific table? Is there something in the name of the CSV file that identifies the target table?

               Where is the directory located?

               If it's located inside your computer's documents folder, you can use Get ( DocumentsPathListing ) to get a list of all files and folders inside documents and you can then parse out a list of the file names to use for importing into your different tables. (And now you can check the file name to determine which import records step to use to import that data.)

               If it's not located in documents, you'll need to use either a system script or a plug in to get the list of files.

               There's a lot of scripting detail that has to be handled here and the details will vary with your operating system,where you locate the directory of files to be imported and what method you use to acquire that needed list of file names.

               Or you can use Import Records | File from the File menu and import one file at a time. Just be sure to select a layout based on the desired target table before selecting this menu option.

          • 2. Re: Importing directory of files into separate tables

                 File >> import records has an option for file or folder. If I import one file then I have the option of importing the data into an existing or new table. However, the folder option seems to only have the ability to import all the files into one table which seems strange to me. I'm trying to import an RDBMS file package I got online that is a collection of CSV files. I would think that the import folder option would have functionality for what I would assume would be a common task.

                 The directory is on my local machine. Browsing to it works fine I'm not sure what you mean about a script to get a list of files. I can import them one at a time but there are a lot of files I'd rather use a bulk import utility if it exists.

            • 3. Re: Importing directory of files into separate tables

                   You would need to create a script to do this.

                   Scripts are created using Manage | Scripts.

                   If this is a one time import of your data, it's probably much less effort to import the tables manually, one at a time.