AnsweredAssumed Answered

10.1 code that populates a field with sequential numbers

Question asked by Shiko on Sep 18, 2013
Latest reply on Sep 18, 2013 by Shiko
Hi folks,
I have a shapefile whose ID and FID numbers are all messed up in the attribute table and I'm looking for code I can type into my "Field Calculator" window that will fill in unique values for each polygon.
Any samples anyone?!!?! :)

Here's what I've tried so far:


The complete code is:

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
  rec = rec + pInterval
return rec

Anyone see any issues that might be causing this not to work?
The error msg I keep getting is the dreaded 99999 error. :confused: