I have a field calculator expression I use in QGIS to generate unique IDs that are sequential, but start with a text string. I now need to perform the same thing in ArcGIS, but I am unsure of how to start. Here is my QGIS expression:

 'cos' || ( tostring(  $rownum  + 1000000))

I was thinking that in ArcGIS it would be something like this:

 "cos"+InStr( [FID] + 1000000 )

But it returned an error.

Any help would be appreciated. Thanks...


There are few different ways to do this in ArcGIS Field Calculator.

If you are fine with basing the ID on the FID, you can use:

"cos" + str(!FID! + 1000000) - make sure you set Field Calculator to Python


"cos + CStr([FID] + 1000000) - make sure you set Field Calculator to VB

If you want your unique IDs to be sequential and not based on the FID the easiest way is to use a Python codeblock in your Field Calculation:


rec = 1000000
def autoIncrement():
  global rec
  id = "cos" + rec
  rec += 1
  return id



The above function will start at the first record in your table with cos1000000 and add 1 to each new record like cos1000001, cos1000002, etc...

| improve this answer | |

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.