How do you populate a Field with consecutive numbers in the field calculator ?
Hello Randy,
The following Field Calculator expression (which must be used with the Python Parser), will auto increment a numeric field. We can modify the pStart = 1 and pInterval = 1 parameters to control the starting number as well as how much it will increment by.
Pre-Logic Script Code:
global rec
rec=0
def autoIncrement():
global rec
pStart = 1
pInterval = 1
if (rec == 0):
rec = pStart
else:
rec += pInterval
return rec
<FieldName> =
autoIncrement()
Best,
Brian