I'm trying to field calculate some records that have a null value. I used the following code from the ESRI help section on sequential calculations. It worked! Now I need to modify the script a bit. This code gives me a sequential order of single digits. I would like to have some zeros before the new assigned digit. 0001 instead of just 1. How do I add the three zeros before the assigned digit? I would like a four digit value in the end. 0001, 0002, 0003, etc.
Here's the python code I used:
pStart = 1 #adjust start value, if req'd
pInterval = 1 #adjust interval value, if req'd
if (rec == 0):
rec = pStart
rec = rec + pInterval
Solved! Go to Solution.
Here is the solution!
Use the original script to sequentially order. After that is done field calculate again using the field you wish to add the extra digits to. Then you can choose the string type as .zfill and add as many zeros as you would like. I attached a screen shot to help clarify. This gave me the result I was looking for!