Subsequent to Auto incrementing every second row in ArcGIS Desktop? , how can i start the auto increment from the second field (i work with 150 fields)

enter image description here

so the result will be:

enter image description here

action = 'repeat'
def autoIncrement(): 
 global rec
 global action  
 pStart = 1  
 pInterval = 1 
 if (rec == 0):  
  rec = pStart
  return rec
  if action == 'count':
   rec += pInterval
   action = 'repeat'
   return rec
  elif action == 'repeat':  
   action = 'count'
   return rec

  • 3
    If you used a modulus math function this function would be significantly faster than the current string comparison. – Vince May 27 '19 at 11:53
  • @Vince Absolutely! I was just trying to build upon the original snippet provided in the OP's first question. – umbe1987 May 27 '19 at 12:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.