# sequential number field in ArcGIS?

How can I get a sequence of numbers 1,2,3,4 from the model below Is there any code I can use in Arcgis to do this in the field Calculator

``````ObjectID   POINT_X    POINT_Y   N_Ordem
179705  277537,5975 167114,8149 1
179705  277546,9257 167111,2111 2
179705  277541,5203 167097,2191 3
179705  277522,8641 167104,4261 4
179705  277528,2697 167118,4183 5
179705  277537,5975 167114,8149 6
179708  277458,3343 167031,5693 1
179708  277452,8895 167017,5923 2
179708  277443,5715 167021,2221 3
179708  277449,0163 167035,1991 4
179708  277458,3343 167031,5693 5
179712  277482,4411 167038,2495 1
179712  277476,9701 167024,3099 2
179712  277467,6521 167027,9397 3
179712  277473,1321 167041,9029 4
179712  277482,4411 167038,2495 5
179717  277543,0029 167128,8071 1
179717  277537,5975 167114,8149 2
179717  277528,2697 167118,4183 3
179717  277533,6747 167132,4109 4
179717  277543,0029 167128,8071 5
``````
• Please use the code sample `{}` to format your data after pasting them into the question. – ahmadhanb Feb 27 '18 at 8:38

It's fairly simple but not obvious, you need to use a global variable:

``````Base = 0
def CalcThis():
global Base
Base += 1
return Base
``````

then in the Field= box type `CalcThis()`, this increments the Base by one and returns it, so you need to set Base to one less than what you want the first number to be.

• +1 This is a much better solution than the old Esri standby: support.esri.com/en/technical-article/000011137 – Aaron Feb 27 '18 at 4:40
• It's fairly much the same @Aaron except that code has a bug: if your start (pStart) value is 0 all the results are 0. I can say though that I developed this method independently. – Michael Stimson Feb 27 '18 at 4:46