I have a Survey123 form that will be used several times a day by over a hundred users. Every record (survey submitted) in my feature layer needs a unique ID. It isn't easy to ensure unique numbers in Survey123. I want to populate the Unique_ID field with COB1, COB1, COB2, and so on. (I prefer that the starting number is 100). Once a record is set, I can't change it again (it may have been exported). I think that a calculated field could be scheduled to run daily in ArcGIS Pro. (I don't entirely know how to do that.) I'm using AcrGIS Pro 2.6 on Windows 10. To start the sequence, I would need to count the number of non-null (or not empty string) values in the Unique_ID field.
I'm new to ArcGIS Pro and Python. I wrote the code below from this example:
https://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field-examples.htm
rec=0
def autoIncrement():
global rec
pStart = 1
pInterval = 1
if (rec == 0):
rec = pStart
else:
rec += pInterval
textRec = "COB" + str(rec)
return textRec
To get the starting value of the sequence, I would need to count all non-empty fields (not null or not empty string). I think that this post shows how to do that: https://community.esri.com/thread/224234-field-calculator-for-not-null-fields.
I'm trying to put this all together. Am I on the right track? Again, I'm new to ArcGIS Pro and Python.
Thanks,
Chuck