How to automatically create ID for existing feature classes?

1205
5
10-19-2023 07:25 AM
Labels (3)
MingLangLi
Emerging Contributor

Hello,

Just wondering that could I automatically to create IDs for the existing feature classes?

 

For example, I have pipes in the database already, the PIPEID fields are all Null, but I do not want to given them the IDs one by one.

MingLangLi_0-1697725468554.png

 

How could I do something to create the IDs automatically.

Your help is appreciated. 

Thank you.

Ming

0 Kudos
5 Replies
leahmaps
Frequent Contributor

Do you have a certain way you want to ID them? Or just 1,2,3, etc?

0 Kudos
RobertKrisher
Esri Regular Contributor

One way to accomplish this would be to write an attribute rule that would run every time a feature is created to give it a unique ID using a sequence. Then what you can do is take that arcade expression and use it in the calculate field tool on this layer (just make sure you set the language to Arcade).

leahmaps
Frequent Contributor

https://youtu.be/T3v5Ff0UDBY?si=dDHdeone6qzHWw48 Here is a YouTube Video explaining how to assign a simple number to the list. 

In words, left click on the field header and choose calculate field. The expression type must be Python 3. 

In the "Helpers" group type (or scroll to) S and click Sequential Number, then apply. This will automatically give numbers to your items in order.

MingLangLi721
New Contributor

Thank you for my late reply. I can do what your refer video says. Last question is how to add letters and symbol in front of the sequential number? Like DESR-?

0 Kudos
RobertKrisher
Esri Regular Contributor

I prefer to use the Concatenate arcade method, but there are several other approaches. You can find an approach that outlines a few ways to handle the prefixing and concatenating in this post (also with a video): Generating Unique IDs with Attribute Rules (NextSe... - Esri Community

0 Kudos