0

I would like to append records from a view to a table to serve as a log. I tried using the ArcGIS Append tool but it creates duplicate records. Is there a way to append only those records from the view that do not already exist in the table?

I'm looking for a way to log every time a checkout replica is created. I created a view that lists all the replicas and their creation date. The fields in the view include: "ReplicaName", "ReplicaVersion", "CreationDate". I want to append new records from the view to the table.

  • 1
    Can you please include a sample of what your records look like? What fields are there - is there an ID or similar that can be used to identify duplicate records? – Midavalo Sep 22 '16 at 23:41
  • You had an arcpy tag but there is no mention of that in your question so I have replaced it by an arcgis-desktop tag. For questions that involve code (like ArcPy) we ask that you show us where you are stuck with your own code by including a code snippet in your question. There is an edit button beneath your question which will enable you to do that and a {} button that enables you to format any highlighted code nicely. – PolyGeo Sep 22 '16 at 23:54
  • perhaps you should adjust the title of this question to "How to append new records without duplicating existing records?" – Stephen Lead Sep 23 '16 at 1:16
  • Are you doing this? => desktop.arcgis.com/en/arcmap/latest/manage-data/geodatabases/… – PolyGeo Sep 23 '16 at 2:22
  • Archiving is not possible in my environment because I'm using checkout/check in replication and the source replica version is not the Default version. – lgt Sep 23 '16 at 21:49
1

All table comparisons should be done using dictionaries and cursors. Load the table that has old records into a dictionary using a searchcursor making the key a tuple of the field values of the record. Then create an updatecursor for that table. Use another searchcursor to read through the table with new records and determine if they do not match your dictionary keys. If they don't, insert them into the table.

I don't have exact code for this problem, but the Geonet discussion below has many similarities to this problem and shows many of the coding structures you would need to adapt to your problem.

https://geonet.esri.com/thread/119381

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.