Select to view content in your preferred language

Identifying Duplicates Arc 9.3

629
0
07-09-2013 11:51 AM
DanaHerman
New Contributor
Hello and thanks for your help!

I want to use the Field Calculator to identify duplicate field values. I found the below instructions/code online which works very well except that it flags single occurrences AND the first occurrence of multiple values with 0 and duplicates with 1. This is great except that I would like BOTH the original record and the duplicate to be marked with a 1, and all single occurrences to be flagged with a 0. Does anyone know how to alter the below instructions/code to make this happen? I tried and I cannot figure it out. Thank you so much! I really appreciate your help!

Instructions/code:

Create a new field. Set the type as long integer and accept the other defaults.
Right-click the field created in the step above and select Calculate Values.
Click the Advanced check box in the Field Calculator dialog box.
Paste the following code into the 'Pre-Logic VBA Script Code' text box:

Static d As Object
Static i As Long
Dim iDup As Integer
Dim sField
'========================
'Replace the field name below
sField =
'========================
If (i = 0) Then
Set d = CreateObject("Scripting.Dictionary")
End If
If (d.Exists(CStr(sField))) Then
iDup = 1
Else
d.Add CStr(sField), 1
iDup = 0
End If
i = i + 1

In the code above, replace with the name of the field containing duplicate records.
The field name must be enclosed in square brackets.
Type iDup in the lower text box of the Field Calculator dialog box.
Tags (2)
0 Kudos
0 Replies