I am trying to use the field calculator to create an alphanumeric sequence, I tried to write a statement but I don't know what is wrong.
So my sequence would be in a field called "Field_number" in the attribute table with my desired sequential values in format (1A001, 1A002....1A999...1B001, 1B002...1B999...1C001). (Total record of 3215)The sequence numbers will range from 001 to 999, and the first two letters will follow the pattern 1A, 1B, 1C, and so on.
After creating my sequence in my Field_number Field, I then need to combine 2 attribute table together. But I am stuck on creating the Alphanumeric sequence field called "Field_number". Final look should be SPLCAR1A001....
Here's my code below: Pre-Logic Script Code:
rec = 0
letter = "A"
def autoIncrement():
global rec, letter
pStart = 1
pEnd = 999
pInterval = 1
if rec < pEnd:
rec += pInterval
else:
rec = pStart
letter = chr(ord(letter) + 1)
return "1{}{}".format(letter, str(rec).zfill(3))