Skip to main content
Solved

Duplicate records inserted using ChangeDetector when key is not present before running

  • July 23, 2024
  • 1 reply
  • 57 views

bill7875
Contributor
Forum|alt.badge.img+3

My workspace is using ChangeDetector with two data sets original and revised. It appears that if the revised records contain two records with the same key and selected attribute and this key does not already exist in the original table then ChangeDetector will want to insert both records in the original table. This happens when the key is not already in the original table before the run. On subsequent runs, ChangeDetector finds the key and selected attribute in the original table, and it behaves as expected and does not insert a record. It treats it as an update or unchanged. How should I account for this? Attached is an image of my workspace. Thank you.

 

Best answer by burgasser

If there are two records with the same key, that will likely be a problem.  The key should be unique.  If the 2nd record is an exact match of the first record, you can use DuplicateFilter to ignore the 2nd record.  If the 2nd record is not an exact match and you need both records, you may want to use a different key that is guaranteed to be unique.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

burgasser
Contributor
Forum|alt.badge.img+5
  • Contributor
  • Best Answer
  • July 23, 2024

If there are two records with the same key, that will likely be a problem.  The key should be unique.  If the 2nd record is an exact match of the first record, you can use DuplicateFilter to ignore the 2nd record.  If the 2nd record is not an exact match and you need both records, you may want to use a different key that is guaranteed to be unique.