hi, there. trying to find duplicate field values in a point class. my current script just flags the first dup it finds (from 1 - X by OID) with a '1'. i'd like to take it to another level by only flagging duplicates in specific coded domains. So if i have three domain values: x, y, and z I'd like to flag only duplicates found in domains y and z while preserving records with domain values of x. hope that makes sense.
thanks!
Can you upload an example of what you've written so far? There would be a number of ways you could implement the logic needed for this and we'd need to see how you beginning this task to give you an appropriate response.
my apologies. yes, here is my current script:
uniqueList = []
def isDuplicate(inValue):
if inValue in uniqueList:
return 1
else:
uniqueList.append(inValue)
return 0
__esri_field_calculator_splitter__
isDuplicate(!fieldx!)
I'd like to flag duplicates for this scenario:
Field: Y X Flag
alpha 222
alpha 333
beta 222 1
charlie 222 1
charlie 333 1
so only duplicates that are NOT alpha will get flagged.
Please try the Summary Statistics geoprocessing tool with COUNT statistic and domain as case field.
uniqueList = [] def isDuplicate(value1, value2, skipValue="alpha"): if value1 == skipValue: return if value2 in uniqueList: return 1 else: uniqueList.append(value2) return 0
you can tweak the above function until you get it the way you want.