0

I am Looking for a python script that will automatically assign a unique sequential value to a field every time a new feature (asset) is created. This ID will also need the abbreviated name prepended to the identifier.

So for example, if I add a new sign (SN) to the signs feature class, I'd like that sign to have an Asset ID of SN235.

Alternatively, I could field calculate each time a new asset or series of assets is added so long as the next feature is given the next sequential value.

I have seen scripts such as this: Auto-incrementing in Python Script with ArcPy cursor?

But it isn't quite what I need.

Has anyone created or come across a script that will do this?

  • You want it to be automatic, like OnCreateFeature? For how many concurrent users? That's a bit beyond what python can do. What database is your data in? Some databases have 'trigger' functions that can be used to assign a unique ID OnNewRow but to do this in ArcGis I'm fairly sure you will need ArcObjects. The Attribute Assistant mentioned by Midavalo would be an ArcObjects form. – Michael Stimson Sep 1 '16 at 22:34
2

Not a python script, but Esri's Attribute Assistant has a tool called Generate ID which will automatically generate a new ID whenever a new feature is created.

These IDs can be created per feature class to generate different IDs for different feature classes, and can be created based on a specific template if required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.