AnsweredAssumed Answered

how to sequentially number a field in Field Calculator (NOT BASED ON FID)

Question asked by pkundu on Apr 10, 2015
Latest reply on Apr 10, 2015 by Dan_Patterson

This may be a very simple question, but I have not found the answer after searching for forever, and all the code snippets I have used have been based off of the FID, which I DO NOT WANT.

 

I have a long list of features which I would like to ID sequentially, but not based off of the FID at all! I just want them to go down the field like (1,2,3,4, etc.). I have tried using the following snippet for Python which was supplied by ESRI, but it doesn't work as it essentially just adds 1 to the FID:

 

Pre-Logic Code:

rec=0

def autoIncrement():

global rec

pStart = 1 

pInterval = 1

if (rec == 0): 

  rec = pStart 

else: 

  rec += pInterval 

return rec

 

Code Block:

autoIncrement()

 

Source: 38517 - Create sequential numbers in a field using Python in the Field Calculator

Attachments

Outcomes