7 Replies Latest reply on May 4, 2012 10:17 AM by Stephen Huston

    Import only entries with new ID

    user14629

      Hi there,

       

      1. On first Import (its XML but thats not important), fields are matched in the import, creating the entries (all with unique IDs).

       

      2. Now I want to import again, this time the XML contains additional entries BUT also the entries from the first import (additional IDs).

       

      3. How do I import only the additional entries without overwriting any records that are already in the DB?

       

      Just give me some basic idea on how to accomplish this...

       

      Thanks in advance

       

      Lars

        • 1. Re: Import only entries with new ID
          Stephen Huston

          In the import options dialog, there is an option to import matching records, and you must select the unique field on which to determine if there is a match via the little arrow between match fields.

           

          After you set that up, also choose the additional option to add non-matching records as new records.

           

          See FM's built-in Help system re import for additional details and examples.

          • 2. Re: Import only entries with new ID
            user14629

            But this way all fields in the entries, that already exist are updated. But I want to keep the records that I have imported before untouched...

             

            Do you see what I am saying?

             

            Thanks for the quick reply...

            • 3. Re: Import only entries with new ID
              Stephen Huston

              The matching option can be set to apply to only the Found Set.

               

              import.png

               

              This should keep it from updating any records if you start with a found set of Zero records. (Show All followed by Show Omitted Only)

               

              However, this will cause it to import ALL records as new (because nothing matched the found set), and you will need a scripted routine to then sort out the duplicates and remove the newest of each dupllicate following the import.

               

              You could avoid both issues if you can find a way to start with an import source containing only new records. (Possibly by using time-stamping or something to know when a record was created in the source?)

              • 4. Re: Import only entries with new ID
                beverly

                Import into a temporary table, create relationship with original table. Find those with no relationship (new records). import into original table.

                 

                Beverly

                 

                Hi there,

                1. On first Import (its XML but thats not important), fields are matched in the import, creating the entries (all with unique IDs).

                2. Now I want to import again, this time the XML contains additional entries BUT also the entries from the first import (additional IDs).

                3. How do I import only the additional entries without overwriting any records that are already in the DB?

                Just give me some basic idea on how to accomplish this...

                Thanks in advance

                Lars

                 

                • 5. Re: Import only entries with new ID
                  PalmDBS

                  Use a "scrub" import table - let FM create a new table for you based on the XML import.  From that Import table, create a relationship to your main records table (ie Import::ID = Records::ID).  Import the XML into the import table.  From the import table, perform a find on your related Records::ID and omit all matches (since they already exists in records).  Then, instead of importing into records from XML, you import into records from your import table (specify your FM file and the import table, it will maintain the found set). 

                   

                  In the future, reimport your XML into the same import table and repeat the above process.  You can either nuke the import table between your imports and start fresh, or you can update matching records based on the ID.  Either way doesn't really matter, as you'll still be omitting all import records with a related/matching Record::ID.

                   

                  HTH,

                  Mike

                  • 6. Re: Import only entries with new ID
                    user14629

                    In this case, the solution was much easier...

                     

                    ADD ONLY in Import dialogue, ID field has validation allways unique: then existing records will not be updated - only new IDs added

                    • 7. Re: Import only entries with new ID
                      Stephen Huston

                      Sometimes all it takes is time to think and a sounding board.

                       

                      Don't forget to mark your own answer as "Correct" -- you earned it!