I have two layers with building footprints I need to update one of them. After merging layers I have some features with an sequential number in the field Bld_ID field but some don't. So i need to update the Bld_ID with sequential number and they start with "Bld": example bld000001, bld00002, bld00003, etc. So some how i need to find the last highest sequential number in the field Bld_ID then add 1 to that and use that to update the buildings i have selected.
I have a code i used for something similar but i am running into the an error with this any help would be appreciated:
Traceback (most recent call last):
File "<string>", line 30, in <module>
IndexError: list index out of range
import arcpy, sys, re, os from arcpy import env import string arcpy.env.qualifiedFieldNames = False arcpy.env.overwriteOutput = True Bld = "BuildingFootprints" #target point feature class BldCount = int(arcpy.GetCount_management(Bld).getOutput(0)) dsc = arcpy.Describe(Bld) selection_set = dsc.FIDSet if len(selection_set) == 0: print "There are no features selected" elif BldCount >= 1: #Gets the highest AddressID and calculates new point to assign new highest AddressID Bld_list =  with arcpy.da.SearchCursor(Bld, ["Bld_ID"]) as cursor: for row in cursor: try: if "Bld" in row: Bld_list.append(int(row.strip("Bld"))) except TypeError: pass del cursor Bld_list.sort() Bld_ID = Bld_list[-1] + 1 Bld_ID = 'Bld' + str(Bld_ID) with arcpy.da.UpdateCursor(Bld, "Bld_ID") as rows: for row in rows: row = Bld_ID rows.updateRow(row) del row del rows