I have inherited a list of assets that contains duplicate features. For reference, the asset number (PTR__) is the duplicate field. I am attempting to label duplicates by using a new 'long' filed and calculating the field using the following script:
uniqueList = []
def isDuplicate(inValue):
if inValue in uniqueList:
return 1
else:
uniqueList.append(inValue)
return 0
I would like to modify this code to also account for whether the point has been GPS's (field:GPS_Y_N). What I am hoping to see is this: if GPS_Y_N = N AND PTR__ is duplicate - return 1, else return 0. However, I am not sure how to modify this to accommodate the additional parameter.
Solved! Go to Solution.
Where is inValue coming from? if its a cursor, then add the GPS_Y_N field and pass that in:
def isDuplicate(inValue, gps):
if all([inValue in uniqueList, gps == 'N']):
return 1
else:
uniqueList.append(inValue)
return 0
If not, use a search cursor and get the value.
Where is inValue coming from? if its a cursor, then add the GPS_Y_N field and pass that in:
def isDuplicate(inValue, gps):
if all([inValue in uniqueList, gps == 'N']):
return 1
else:
uniqueList.append(inValue)
return 0
If not, use a search cursor and get the value.