AnsweredAssumed Answered

Sequential Numbering based on last numbering

Question asked by CCweedcontrol on Jun 29, 2018
Latest reply on Jul 2, 2018 by fallingdog

I have a road layer that i need to add sequential numbering to, the RD_ID field. Some already have a RD_ID number and some are missing. I need to populate attributes of only the missing ones that only have CC in front of them but in sequential order but starting from the last number left off at. I attached a picture of what i need. thanks.

 

I have the following that adds sequential ID but it doesn't take in consideration where the last RD_ID left off.

import arcpy

fc = r'C:\Temp\Roads.shp'

startNumber = 0

with arcpy.da.UpdateCursor(fc, "RD_ID") as cursor:
    for row in cursor:
            row[0] = startNumber
            startNumber = startNumber + 1
            cursor.updateRow(row)

print 'Done'

Attachments

Outcomes