How to recreate a sequential field value using ObjectID value

2353
13
Jump to solution
05-05-2023 07:29 AM
Labels (2)
AndrewAidt2
Regular Contributor

I am trying to get an empty unique ID field populated. The field is CarteID. I want a prefix of SSP and use the ObjectID field. Example: ObjectID is 10234 - I want the CarteID to be SSP10234. Using Python 3, how do I use the field calculator to populate this field. What Expression do I use?

Then, going forward, is there a way to automatically populate this field when someone adds a new feature?

Thank you!

0 Kudos
13 Replies
RhettZufelt
MVP Notable Contributor

That is the line number.  Not sure why yours is black (or mine is blue), probably a windows setting.

you can turn that on/off with right click (in Code Block as well).

RhettZufelt_1-1683310094108.png

Did you get it to work?

R_

 

0 Kudos
RhettZufelt
MVP Notable Contributor

OIC your issue now, yeah, that is a line number automatically inserted by Pro, NOT part of the code.

With line numbers off, should look more like this (with nothing in the Code Block section):

RhettZufelt_2-1683310435374.png

 


R_

AndrewAidt2
Regular Contributor

Yes! Finally got it to work. I had other issues with unregistered feature classes I had to fix first.

0 Kudos
AndrewAidt2
Regular Contributor

RhettZufelt Thank you!

0 Kudos