Skip to main content
deleted 6 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

FYI...II used model builderModelBuilder and I did a field sort followed by calculate field using the sort code below and it worked great. Previously

Previously, I had tried these two steps outside of model builderModelBuilder and it failed.

Expression:

autoIncrement()

Expression Type: PYTHON_9.3

Code Block:

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

FYI...I used model builder and I did a field sort followed by calculate field using the sort code below and it worked great. Previously, I had tried these two steps outside of model builder and it failed.

Expression:

autoIncrement()

Expression Type: PYTHON_9.3

Code Block:

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

I used ModelBuilder and I did a field sort followed by calculate field using the sort code below and it worked great.

Previously, I had tried these two steps outside of ModelBuilder and it failed.

Expression:

autoIncrement()

Expression Type: PYTHON_9.3

Code Block:

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

FYI...I used model builder and I did a field sort followed by calculate field using the sort code below and it worked great. Previously, I had tried these two steps outside of model builder and it failed.

Expression: autoIncrement()

autoIncrement()

Expression Type: PYTHON_9.3

Code Block: 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

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

FYI...I used model builder and I did a field sort followed by calculate field using the sort code below and it worked great. Previously, I had tried these two steps outside of model builder and it failed.

Expression: autoIncrement()

Expression Type: PYTHON_9.3

Code Block: 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

FYI...I used model builder and I did a field sort followed by calculate field using the sort code below and it worked great. Previously, I had tried these two steps outside of model builder and it failed.

Expression:

autoIncrement()

Expression Type: PYTHON_9.3

Code Block:

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
Source Link
Steph
  • 74
  • 1
  • 1

FYI...I used model builder and I did a field sort followed by calculate field using the sort code below and it worked great. Previously, I had tried these two steps outside of model builder and it failed.

Expression: autoIncrement()

Expression Type: PYTHON_9.3

Code Block: 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