Two exports contain the same records in a different order. Compare line 20 with line 20 and you can manufacture a change that never happened.
Start with the meaning of the key. Is it an order ID, a SKU or a customer ID? Keep it as text when leading zeros matter: 001 and 1 may identify different records.
Then check the keys before comparing values. Empty IDs cannot establish a match. Duplicate IDs make the match ambiguous. Silently picking the first duplicate gives you a tidy report with an unreliable answer.
Make field mapping explicit too. Stock in one export and Qty in another might describe the same thing. A field you exclude from comparison should not turn an otherwise unchanged record into a change.
Finally, split the report into added, removed, changed, unchanged and rejected records. Inspect the rejected group before trusting the totals. Keep a copy of the comparison rules next to the report.
Disclosure: This article was prepared with AI assistance and reviewed against the linked sources and implementation. Examples explicitly marked fictional are illustrative.
Top comments (0)