Recently I was creating a HUGE figure which needed to reference all the features in the map with a number, so, as I would normally, I went to the attribute table, created a new field and opened up the ArcGIS Field Calculator, then opened up Ian Ko’s Easy Calculate (EC50 to you REAL GIS nerds) in preparation to use the “REC” command…..only it didn’t work
It turns out that EC50 doesn’t work with ArcGIS 10.1, so what did I do?……I used Python!!
Here is the ESRI resource page on how to create sequential numbers, easy peasy – even a Python noob like me got it to work!!
HowTo: Create sequential numbers in a field using Python in the Field Calculator
|Software:||ArcGIS – ArcEditor 10 ArcGIS – ArcInfo 10 ArcGIS – ArcView 10|
- Create a new short integer field.
- Set the Parser to Python.
- Select Show Codeblock.
- Paste the following into the Pre-Logic Script Code:
rec=0 def autoIncrement(): global rec pStart = 1 pInterval = 1 if (rec == 0): rec = pStart else: rec += pInterval return rec
- Paste the following code in the smaller box below the Pre-Logic Script Code:
- Click OK.