0

This code below auto-increments based on the FID/OID in the attribute table. How can I auto-increment a column based on a sort of another column? I don't want it to follow the FID/OID. Please advise.

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

merged by PolyGeo Aug 26 at 10:32

This question was merged with Sorting feature class to calculate sequential ID field using ArcGIS Field Calculator? because it is an exact duplicate of that question.