# SOLUTION for adding new sequential ID numbers based on sorted data

Discussion created by sirgeo on Feb 8, 2011
Latest reply on Feb 27, 2013 by cfox-esristaff
Finally found this in ET GeoWizards, see attachment.
ET GeoWizards did it again and provided solution for a simple task:D

for the record none of the following provided solutions:
Accumulative and sequential calculations http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Calculate_Field_examples/00170000004s000000/
HowTo:  Create sequential numbers in a field using Python in the Field Calculator http://resources.arcgis.com/content/kbase?fa=articleShow&d=38517
Expression:
autoIncrement()
Expression Type:
PYTHON_9.3
Code:
rec=0
def autoIncrement():
global rec
pStart = 1 #adjust start value, if req'd
pInterval = 1 #adjust interval value, if req'd
if (rec == 0):
rec = pStart
else:
rec = rec + pInterval
return rec
Field_Name:
autoIncrement()
Performs the same as �??FID +1�?�

permanently_sort_records_v93.zip
http://arcscripts.esri.com/details.asp?dbid=16771
nothing but errors using this PSR

ASSIGN AN ID USING THE FIELD CALCULATOR
every code I have come across only works on creation order, not sort order.

Use the Field Calculator to populate a field with ordered numbers http://resources.arcgis.com/content/kbase?fa=articleShow&d=31374
above code worked as far as populating the field, but the numbers were consecutive based on the FID field, not by how I had the table sorted
Populating a Field with consecutive numbers
G. Venkata Vijay Kumar�??s VB code doesn�??t work: expected error 999999

Create a sequential unique ID field equivalent to the ArcView 3.x field calculator expression rec+1 http://resources.arcgis.com/content/kbase?fa=articleShow&d=27427
Expected error 999999
add sequential numbers to a table