3 Replies Latest reply on Mar 19, 2009 11:17 AM by philmodjunk

    Import csv records into current database

    lamp

      Title

      Import csv records into current database

      Post

      Dear All,

       

      I have a csv file I want to import records into current database. Different field should be inserted in different table these tables have relations.

       

      I'll appreciate if any one can tell me please how can I import each field in related table?

      please let me know if you need more explanation 

       

      Thanks in advance

       

      Lamp 

        • 1. Re: Import csv records into current database
          philmodjunk
            

          Do one import for each table. During each import you should be able specify which fields get copied to the current target table. What this does is split the data from your csv file into several related FMP tables which is what you want correct?

          • 2. Re: Import csv records into current database
            lamp
              

            Thanks a lot for reply

             

            the problem is the tables have relations. for example I have tables (Company and Contacts). primary key for (Company0 is foregn key for (Contacts).

             

            Is there any way I can create a loop first put fields from csv file into Company fields and take the CompanyID put it in Contact table as foreign key and the put the fields from csv file into contacts fields

             

             

             

            • 3. Re: Import csv records into current database
              philmodjunk
                

              And this Key value is not in your csv file? If it is then my previous approach works. If not, then this will take some more work.

               

              If the key values aren't in your CSV, I suggest importing into a intermediate table where you can add in the necessary values. Scripts, replace, calculation fields are all possible methods, depending on what these key values are and how you go about generating them.

               

              Once you've done this you can either use import records (this requires that your intermediate table reside in a seperate file) or you can use a script that loops through your set of imported records and uses set field to copy the data over one field at a time.