I'm trying to modify the autoIncrement() python script to auto number based on another field. For example, I need the autoincrement to restart when the field "STD_ID" changes value. This is my attempt but I'm not getting the results I need.
rec=0
stand = "STD_ID"
stand2 = "STD_ID"
def autoIncrement():
global rec
global stand
global stand2
pStart = 1 #adjust start value, if req'd
pInterval = 1 #adjust interval value, if req'd
stand2 = "STD_ID"
if (rec == 0):
rec = pStart
elif (stand2 == stand):
rec = rec + pInterval
else:
rec = 1
stand = "STD_ID"
return rec
elsewill never be hit, aselif stand2 == standwill always be true (as far as I can tell). the values for these two parameters never change fromSTD_ID– Midavalo Mar 16 '17 at 22:44