In my feature table I have a column labeled 'Sequence' which I would like to add sequential numbering to which resets with each new day.
8/3/2020 | 1
8/3/2020 | 2
8/3/2020 | 3
8/3/2020 | 4
8/4/2020 | 1
8/4/2020 | 2
Are you looking for an automated solution to correct a few months of sequence data? I've done that sort of things with an update cursor:
fc = r'C:\some\path\to\your\data'startValue = 1fields = ['YourFieldName']where = "A a sql select statement for a particular date'arcpy.MakeFeatureLayer_management(fc,'fcLayer')arcpy.SelectLayerByAttribute_management('fcLayer', 'NEW_SELECTION', where)with arcpy.da.UpdateCursor('fcLayer',fields)as cursor: for row in cursor: row = startValue cursor.updateRow(row) startValue += 1
If you have a list of dates, you could loop through it and create the where statement on the fly. I think the update cursor will update in order of object id for the selected set, but don't quote me on that.
***Untested for this particular application...
What product are you using? "Traditional Desktop (10.x)" or ArcGIS Pro?
If the latter, you could write a script that deletes and then re-creates a database sequence, and run it every night at 00:00:01 hours as a scheduled task.
Create Database Sequence (Data Management)—ArcGIS Pro | Documentation
Delete Database Sequence (Data Management)—ArcGIS Pro | Documentation
ListDatabaseSequences—ArcGIS Pro | Documentation (only available for file geodatabases: vote here to have it ported to enterprise geodatabases... arcpy.ListDatabaseSequences() for EGDB )
This is in ArcPro. I currently have script that runs this each night for the current day but recently it had a hiccup so I'm having to go back and correct a few months of sequence data.
Retrieving data ...