<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Populate a field as sequential number using autoIncrement in field calculator in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438319#M25022</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thomas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://stackoverflow.com/questions/19029114/adding-new-sequential-id-numbers-based-on-sorted-data-arcgis"&gt;This might help&lt;/A&gt;&lt;SPAN&gt;?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Apr 2014 14:37:47 GMT</pubDate>
    <dc:creator>TimWitt</dc:creator>
    <dc:date>2014-04-09T14:37:47Z</dc:date>
    <item>
      <title>Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438318#M25021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to populate a field with sequencial numbers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I could go the easy way and input in the field calculator: FIELD = 1+ [FID]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I want my data to be first sorted so what i would like would be more something like&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Sorting my data&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) FIELD = ROW&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And so once sorted the FID is not relevant to the row number...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've read things online and it seems that autoIncrement is my solution but I can't seems to have it working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code I got from the help:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Expression:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;autoIncrement()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Expression Type:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PYTHON_9.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code Block:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rec=0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;def autoIncrement():&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; global rec&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pStart = 1 #adjust start value, if req'd &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pInterval = 1 #adjust interval value, if req'd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; if (rec == 0): &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; rec = pStart &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; else: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; rec = rec + pInterval &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; return rec&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here how I input it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's my error message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My field i'm trying to populate is called label and is a short integer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 14:29:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438318#M25021</guid>
      <dc:creator>thomasdesalle</dc:creator>
      <dc:date>2014-04-09T14:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438319#M25022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thomas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://stackoverflow.com/questions/19029114/adding-new-sequential-id-numbers-based-on-sorted-data-arcgis"&gt;This might help&lt;/A&gt;&lt;SPAN&gt;?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 14:37:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438319#M25022</guid>
      <dc:creator>TimWitt</dc:creator>
      <dc:date>2014-04-09T14:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438320#M25023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks this is interresting. Sadly I've never run a python script so I don't know how to do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you explain the basic idea of it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) sort my shapefile as fit me&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) open python console (is this the python I can find in my windows start menu?)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) then copy the following in the console&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rows = arcpy.UpdateCursor("your attriubute table") &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;counter = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for row in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; row.NEW_ID = counter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; rows.updateRow(row)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; counter += 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What should I insted of "your attriubute table"="C:\GIS\Shapefiles\interp\interp_polygon.dbf" ???&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 14:55:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438320#M25023</guid>
      <dc:creator>thomasdesalle</dc:creator>
      <dc:date>2014-04-09T14:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438321#M25024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thomas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000017000000"&gt;This&lt;/A&gt;&lt;SPAN&gt; should help you find where you need to input this code and &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000064000000"&gt;here&lt;/A&gt;&lt;SPAN&gt; is an example of an update cursor (You can see they first define FC as the path to their table)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 16:07:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438321#M25024</guid>
      <dc:creator>TimWitt</dc:creator>
      <dc:date>2014-04-09T16:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438322#M25025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your original post has the correct code.&amp;nbsp; However, you did not check the Parser radio button at the top of the Field Calculator dialog to perform a Python calculation.&amp;nbsp; The code won't work as a VB Script calculation, which is what you were doing.&amp;nbsp; So go back and input that code and change the Parser radio button setting to "Python" and it will uniquely number your records.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 18:37:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438322#M25025</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-04-09T18:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438323#M25026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, thank you so much for your help already.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not there yet but hopefully it will work soon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Let's talk python script within field calculator first:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So to summarize:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1)I have a field called LABEL (short integer) within a attribute table of a polygon shapefile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2)I start editing and open the attribute table&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) In field calculator I input that code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;rec=0 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;def autoIncrement(): &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; global rec &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pStart = 1 #adjust start value, if req'd &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pInterval = 1 #adjust interval value, if req'd &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; if (rec == 0): &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; rec = pStart &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; else: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; rec = rec + pInterval &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; return rec &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Which I have tried with or without the indentations&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4) I input it the same way as above but ticking the python parser tick box (screengrab was wrong)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5) It doesnt work and got these results:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;=&amp;gt; I really cannot see what is wrong in there&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;=&amp;gt; Can it be my arcgis 10.0 (build 2414) which is doing some problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;=&amp;gt; Due to IT support I'm not admin on my machine and can't do much changes is this could affect me?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll have a read throught the other solution you have offer see if I'm more lucky.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for taking time to answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thomas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 07:58:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438323#M25026</guid>
      <dc:creator>thomasdesalle</dc:creator>
      <dc:date>2014-04-10T07:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438324#M25027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Don't know if this is any help but here it is too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;IMG src="http://i62.tinypic.com/2euiurq.jpg" /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 08:02:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438324#M25027</guid>
      <dc:creator>thomasdesalle</dc:creator>
      <dc:date>2014-04-10T08:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438325#M25028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have also tried the python windows without much success:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are a few exemples:&lt;/SPAN&gt;&lt;BR /&gt;&lt;IMG src="http://i58.tinypic.com/8vublk.jpg" /&gt;&lt;BR /&gt;&lt;IMG src="http://i62.tinypic.com/ws9086.jpg" /&gt;&lt;BR /&gt;&lt;IMG src="http://i62.tinypic.com/23twsz.jpg" /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope the screen grab can help, sorry they are quiet large displayed on the screen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is my python just not working?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 08:28:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438325#M25028</guid>
      <dc:creator>thomasdesalle</dc:creator>
      <dc:date>2014-04-10T08:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438326#M25029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is the Field calculator set up specifying each item in the Field Calculator set up dialog in order.&amp;nbsp; Always include the indentations when using Python code exactly as written, indentations are essential to Python.&amp;nbsp; Capitalization can also be important in Python.&amp;nbsp; This code works in ArcGIS 9.3 and up.&amp;nbsp; No special set up or rights is required.&amp;nbsp; Paste the code exactly as written below within the code tags.&amp;nbsp; I just ran the code as shown and it worked without error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Parser:&amp;nbsp; Python&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Show Codeblock: checked&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pre-Logic Codeblock:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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): 
&amp;nbsp; rec = pStart 
 else: 
&amp;nbsp; rec = rec + pInterval 
 return rec&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Expression (Label): autoIncrement()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The screen shot shows how the Field Calculator set up should look (I have scrolled down in the Codeblock window to show the indentation required in the lower half of the code, which your screenshot did not show.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The error being reported is a parsing syntax error, indicating that you did not indent the code correctly according to Python requirements.&amp;nbsp; But since you have not pasted your code within code tags to preserve your indentation I cannot tell where the error is located.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:36:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438326#M25029</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T19:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438327#M25030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is the required indent for the Python window code.&amp;nbsp; Indentations must be included as shown below for Python to work.&amp;nbsp; You also had the wrong field name (NEW_ID) for the 6th line.&amp;nbsp; It should read row.Label = counter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
rows = arcpy.UpdateCursor("C:/gis/yourgeodatabase.gdb/mag_interp_polygon") 

counter = 1
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Label = counter
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp; counter += 1&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Most likely you have input the incorrect path and feature class name into the cursor input of the second line.&amp;nbsp; Your feature class is named "mag_interp_polygon" according to the field calculator error, not Label (the field name, which is not included in the cursor input of line 2).&amp;nbsp; I don't know the actual path or geodatabase name you are really using, but they are almost certainly wrong in what you have written and they are wrong above, since I don't know these essential pieces of information.&amp;nbsp; The path, gdb name (if applicable) and file name or the layer name must be correct for the code not to error with a 99999 error.&amp;nbsp; Screen shot the Layer Properties of the feature class you are updating on the Source Tab page to tell us the actual correct path and feature class name you need to input to the cursor.&amp;nbsp; You may also be able to input just the layer name shown in your map instead of its on disk path and file name.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:36:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438327#M25030</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T19:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438328#M25031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Label field should be a Long Integer field for good measure.&amp;nbsp; If you auto increment more than 32,767 records the Field Calculator will throw an error.&amp;nbsp; There is really no reason to limit yourself to that few number of records in any data set as far as I am concerned.&amp;nbsp; What if this data was still being tracked in the year 3,000 with a complete history back to your database?&amp;nbsp; Will 32,767 records really be enough?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unlike in the movies, in programming "Failure is always an option" as you clearly can see.&amp;nbsp; In fact with computer programming failure is always the expected result at some point in the program unless every single step is done correctly and no unanticipated conditions arise.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 10:27:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438328#M25031</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-04-10T10:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438329#M25032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I recommend that you only use the Field Calculator option to maintain sequential numbers.&amp;nbsp; The script option as written will overwrite every sequential number in the Label field every time it is run.&amp;nbsp; It does not use any layer that is in any map or any selection in a layer to limit the records that it overwrites.&amp;nbsp; That is because you are supplying a path to the feature class on disk, not a connection to the layer in your open map.&amp;nbsp; A few other lines of code would be needed to connect to the layer in your currently open map and any selection it may contain.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Field Calculator option is designed to work on a layer in your currently open map and will respect any selection of records you may have chosen.&amp;nbsp; This allows you to avoid overwriting previously assigned sequential numbers and continue the numbering only for records that have no Label value.&amp;nbsp; So even if you get both to work, I would only go with the Field Calculator after the initial sequential number assignment for any continuing maintenance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 13:22:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438329#M25032</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-04-10T13:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438330#M25033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Paste the code exactly as written below within the code tags.Pre-Logic Codeblock:&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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): 
&amp;nbsp; rec = pStart 
 else: 
&amp;nbsp; rec = rec + pInterval 
 return rec&lt;/PRE&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;First of all, thank you so much to spend so much time pointing me to the right direction.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So from what I read on your post I got some positive output and some negative one too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So the positive:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The python code with the right indentation works!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Which I don't understand why he was wrong in the first place because I copied it straight from the help of arcgis...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The negative:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It works and create a string but not what I want it create the same than &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;label=[FID]+1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and not a&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;label=[raw ofter sorting]+1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i wanted&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;see the result&lt;/SPAN&gt;&lt;BR /&gt;&lt;IMG src="http://i61.tinypic.com/2lwlpis.jpg" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:36:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438330#M25033</guid>
      <dc:creator>thomasdesalle</dc:creator>
      <dc:date>2021-12-11T19:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438331#M25034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The Label field should be a Long Integer field for good measure.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the tip, in this case the label is for a group of 340 features which shouldn't expend to any crazy number that why I went for short integer. But you're probably right that as a default long integer is probably better.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally as I had only 340 entry I filled the label field manually. I had already lost too much time trying to do this automatically.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 10:46:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438331#M25034</guid>
      <dc:creator>thomasdesalle</dc:creator>
      <dc:date>2014-04-11T10:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438332#M25035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I recommend that you only use the Field Calculator option to maintain sequential numbers.&amp;nbsp; The script option as written will overwrite every sequential number in the Label field every time it is run.&amp;nbsp; It does not use any layer that is in any map or any selection in a layer to limit the records that it overwrites.&amp;nbsp; That is because you are supplying a path to the feature class on disk, not a connection to the layer in your open map.&amp;nbsp; A few other lines of code would be needed to connect to the layer in your currently open map and any selection it may contain.&lt;BR /&gt;&lt;BR /&gt;The Field Calculator option is designed to work on a layer in your currently open map and will respect any selection of records you may have chosen.&amp;nbsp; This allows you to avoid overwriting previously assigned sequential numbers and continue the numbering only for records that have no Label value.&amp;nbsp; So even if you get both to work, I would only go with the Field Calculator after the initial sequential number assignment for any continuing maintenance.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't had time to try the code option further. Thanks again for your help. I don't use GIS very much at all and this is very instructive.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thomas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 10:48:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438332#M25035</guid>
      <dc:creator>thomasdesalle</dc:creator>
      <dc:date>2014-04-11T10:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438333#M25036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The negative:&lt;BR /&gt;It works and create a string but not what I want it create the same than &lt;BR /&gt;label=[FID]+1&lt;BR /&gt;and not a&lt;BR /&gt;label=[raw ofter sorting]+1&lt;BR /&gt;i wanted&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I assume you meant to type:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;label = [row after sorting] + 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That is a limitation of the Field Calculator method.&amp;nbsp; It operates on the records only in ObjectID order and not based on any layer sorting criteria.&amp;nbsp; Because ObjectIDs are not necessarily sequential and can skip values due to record deletions, the code is primarily useful for reestablishing an unbroken sequence of numbers.&amp;nbsp; So while it does not achieve your objective it still has value for what it is designed to do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To use sorting, the scripting option with the cursor is the only available approach, or you actually have to output the data to a new physically resorted feature class with the Sort tool.&amp;nbsp; A cursor can apply a sorting order on the data prior to operating on it, but the sort criteria has to be fed directly to the cursor set up as a string.&amp;nbsp; Record sorting slows the cursor performance significantly and should only be used where it is absolutely necessary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nothing I have seen can use the layer sort criteria you set up in ArcMap directly to do any ordered manipulation of data, since the Table View order does not actually exist anywhere but in the Table View.&amp;nbsp; The Table View sort is primarily an in memory manipulation that has no effect on the actual record order read by any tool.&amp;nbsp; Manually entering data using that sorted view is the only option that can take advantage of a Table View sort.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With only 340 records a manual approach is practical and what I would have recormmended in the first place.&amp;nbsp; Or copy the data to Excel, do the sort and numbering and then bring that back into ArcMap and join it to the table to transfer the numbers into the table with the Field Calculator.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the field calculator to calculate the original ObjectID values of your source into a new long field, then using the Sort tool, and finally Joining the sorted output back to the original data source on the field you calculated and using the Field Calculator to transfer the new sorted ObjectIDs of the sorted output back to the source is the geoproccessing approach to this problem that works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you ever need to to do the same type of operation with a significant data set (over 25,000 records), then the scripting approach will be worth every minute you spend on it and you won't regret any part of the learning curve needed to master Python or .Net.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 15:55:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438333#M25036</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-04-11T15:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438334#M25037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;AM following this post and am having sequential numbering problems.&lt;/P&gt;&lt;P&gt;Simply I need to take about 5000 features all labeled XTLF_XTLF0001000000* and make them read&lt;/P&gt;&lt;P&gt;XTLF_XTLF00010000001.........XTLF_XTLF00010004934&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Sep 2015 19:18:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438334#M25037</guid>
      <dc:creator>MikeFroese</dc:creator>
      <dc:date>2015-09-03T19:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a field as sequential number using autoIncrement in field calculator</title>
      <link>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438335#M25038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000;"&gt;The code below should work to sequence the numbers in the format you want as long as it is for a single prefix and &lt;SPAN style="color: #000000; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;the sequence does not &lt;/SPAN&gt;restart for different groups of records:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000;"&gt;Parser:&amp;nbsp; Python&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000;"&gt;Show Codeblock: checked&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000;"&gt;Pre-Logic Codeblock:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="bar"&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;rec=0&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;def autoIncrement():&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt; global rec&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt; pStart = &lt;SPAN style="color: #000000; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;10000001&lt;/SPAN&gt; # adjust start value, if req'd&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt; pInterval = 1 # adjust interval value, if req'd&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt; if (rec == 0):&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&amp;nbsp; rec = pStart&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt; else:&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&amp;nbsp; rec = rec + pInterval&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt; return "XTLF_XTLF{011d}".format(rec)&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #000000;"&gt;Expression (Label): autoIncrement()&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 16:00:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/populate-a-field-as-sequential-number-using/m-p/438335#M25038</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-09-04T16:00:25Z</dc:date>
    </item>
  </channel>
</rss>

