I what i am trying to accomplish is a script that generates a concern ID that is based on a the last highest number that will run as a scheduled task. An example would be C100, C101, (C102, C103, and C104 were deleted), C105 where the next ID would be C106 and not overwrite C105 as C102 and continue to C103.
I found main part of this code somewhere, and I like how it concatenates a letter along with a number. I am up for adding fields that store a number and then concatenates the final ID later, or whatever it takes so long as it quick. Example would be: ConcernID, PrefixCode, LastNumber (all fields used in script). PrefixCode would be a default value of C and the LastNumber field would hold the number portion, and combine them to form the ConcernID.
This will be eventually used with an enterprise geodatabase feature class. Any suggestions would be greatly appreciated.
# Create update cursor for feature class
fc = r'C:\Requests\Test\Seq.gdb\GeoReportingManagement\GeoReporting'
fields = "ConcernPrefix; Point; ConcernID"
# Workspace is the connection to the database where fc is stored - DMB
workspace = r'C:\Requests\Test\Seq.gdb'
# Starting an Edit Session - DMB
edit = arcpy.da.Editor(workspace)
rows = arcpy.UpdateCursor(fc, fields=fields, sort_fields=sort_fields)
previousPoint = None
i = 0
for row in rows:
munic = row.getValue('ConcernPrefix')
# point = row.getValue('Point')
if not previousPoint:
i += 1
elif previousPoint <> point:
i = 1
i += 1
# previousPoint = point
# Closing the Edit Session - DMB