This is a topic that's been around for as long as I can remember. The attribute assistant provided a couple methods to do this: autonumber, generate id, and there us a tool called Add Incrementing ID field but it is limited to database tables, not GEOdatabase tables; if an object id is present, the tool won't work.
Is there a method or tool available in ArcGIS Pro 2.4.3 that will autoincrement a field in an enterprise geodatabase table and/or feature class?
Joe - not sure the details of your workflow but there is a "Add Incrementing ID Field" GP tool that "may" work for you. Have you seen/used this before?
Robert- for some reason the second half of my post didn't make the trip. I looked at that tool, but it has limited application to a database table, not a GEOdatabase table. If an object id already exists, the tool won't work...
Yes, limited for sure. I did look into the ObjectID issue you mentioned and the Help says "If you do not specify a name for the field, ObjectID is used by default. If a field named ObjectID already exists, the tool will not run until you provide a different name." So you could create a new field for the unique values and then the GP tool would run.
These are two lines in the help that pretty much torpedo my use of the tool:
This tool can only be used with database tables, not geodatabase tables.
If a database-maintained, incrementing ID field already exists in the table, this tool will not add another one.
My use case is when a record is added, I need to generate an incremental unique id; I could use a trigger on the back-end sql database, but I'd like to avoid that if at all possible.
Yes, those 2 lines would definitely throw a monkey wrench in not being able to use the tool. Just guessing here but I'm thinking a trigger on the back end might be the best approach. I'd be curious to see if others reading this post have other ideas.
There are some python calculator approaches you can find with dr google; here's one from esri but it just calcs a field for the entire feature class or table.
Taking a look at Attribute Rules. The help states:
To save time during editing, specific attribute values are automatically populated for newly created features. For example, when a new pole is created, the assetID attribute is generated based on a sequence.
Just took a stab at Attribute Rules and it provides the solution I'm after.
Attribute rules use Arcade so this rule will add the text SomePrefix along with the next number in the sequence. I started the sequence at 100 an incremented by 1. Once you have the run the add attribute rule tool, you are ready to make your edits....
This is exactly what I've been attempting to do. However, I'm using desktop. Thoughts?