Can anyone help me with a field calculation script?
I have a field for sewer lines that has a unique code that increases by one for every new line added we typically have dozens of line segments added at a time. I would like to automate this field entry.
last existing field ex 'SSP1000' New feature field would become 'SSP1001"
I am green with python, thanks in advance!
Solved! Go to Solution.
last = 8 # ---- change me
def seq_cal():
"""change last = 1 line to show last """
global last
a = 1
if last == 0:
last = a
else:
last = last + a
return "SSP{:>04}".format(last)
python parser
you need a code block
emulate the above
highlight the rows you want to calculate
change the last = .... line to enter your previous value
last = 8 # ---- change me
def seq_cal():
"""change last = 1 line to show last """
global last
a = 1
if last == 0:
last = a
else:
last = last + a
return "SSP{:>04}".format(last)
python parser
you need a code block
emulate the above
highlight the rows you want to calculate
change the last = .... line to enter your previous value
Dan,
Thanks for the response. I am still learning python. so the script should look like this for my data?
I have verified it. It works like a charm! You the Man!
Glad it worked out James