AnsweredAssumed Answered

calculate the value of a record (an unique id), if the record is selected?

Question asked by ionarawilson on Jul 9, 2013
Latest reply on Jul 12, 2013 by ionarawilson
Is there a way to calculate the value of a record (an unique id), if the record is selected? Right now I have something that calculates a sequential unique id but the records have to be unselected. Thanks!!!

     arcpy.SelectLayerByAttribute_management("Stewardship", "CLEAR_SELECTION") ##     filter = 'NOT SequenceNumber IS NULL' #filter for non-Null values     cur1 = arcpy.UpdateCursor("Stewardship", filter, "", "", "SequenceNumber A") # FILE should be updated to the file you're working with  # Iterate through rows and get highest ID values     high_id = 0     for row1 in cur1:         if high_id < row1.SequenceNumber:             high_id = row1.SequenceNumber       filter = 'SequenceNumber IS NULL' #filter for Null values     cur2 = arcpy.UpdateCursor("Stewardship", filter)      # Iterate through rows and update values     i = high_id     for row2 in cur2:         i += 1         row2.SequenceNumber = (i)         cur2.updateRow(row2)

Outcomes