Pre-Logic Script Code: d = {} # creates an empty dictionary the first time def findDuplicates(inVal): try: d[inVal] += 1 # works only if this value has been encountered before (is a valid key) return d[inVal] # returns the number, you could just make this return 1 except KeyError: d[inVal] = 0 # if this is the first time, highlight it return None # or 0... Expression: dup = findDuplicates(!Unique_ID!)
Pre-Logic Script Code: d = {} # creates an empty dictionary the first time def find_duplicates(in_val): d[val] = d.setdefault(val, -1) + 1 return d[val] Expression: dup = find_duplicates(!Unique_ID!)
findDuplicates(!Unique_ID!
findDuplicates(!Chris_ID!)
Pre-Logic Script Code: d = {} # creates an empty dictionary the first time def find_duplicates(val): d[val] = d.setdefault(val, -1) + 1 return d[val] Expression: dup = find_duplicates(!Unique_ID!)
Pre-Logic Script Code: d = {} # creates an empty dictionary the first time def find_duplicates(valX,valY): d[(valX,valY)] = d.setdefault((valX,valY), -1) + 1 return d[(valX,valY)] Expression: dup = find_duplicates( !SHAPE.firstpoint.x!, !SHAPE.firstpoint.y! )
Hi,Actually, I was working with Address Points and had to calculate Spatial Duplicates(same X & Y Coordinates) and Address Duplicates(same attributes). gnewburyiv gave the idea and it worked. Gracias. Now, for address duplicates, I need to check for more than two fields(valX, valY, valZ, valA, valB etc.). What can be done in this case. (:
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.