Select to view content in your preferred language

Modifying unique value definition to account for multiple factors?

362
1
Jump to solution
11-29-2022 11:25 AM
AustinAverill
Emerging Contributor

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.

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

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.

View solution in original post

0 Kudos
1 Reply
by Anonymous User
Not applicable

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.

0 Kudos