<?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 Sequential Number for a Number Field in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/sequential-number-for-a-number-field/m-p/554444#M43350</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want to update a record with a sequential number. Every time the user adds a record, the sequence attribute increases by 1. So record digitized for the first time has a sequence number of 1, the second record gets a sequence number of 2, etc. The record has to be selected when this update occurs. The sequence field is of data type number, but I could create a string attribute if necessary. I tried the following but keeps getting a 1 for all the records. What am I doing wrong? Thank you!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; filter = 'NOT Sequence IS NULL' #filter for non-Null values
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur1 = arcpy.UpdateCursor("Stewardship", filter) 

# Iterate through rows and get highest ID values
&amp;nbsp;&amp;nbsp;&amp;nbsp; high_id = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row1 in cur1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if high_id &amp;lt; row1.Sequence:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; high_id = row1.Sequence


&amp;nbsp;&amp;nbsp;&amp;nbsp; filter = 'Sequence IS NULL' #filter for Null values
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur2 = arcpy.UpdateCursor("Stewardship", filter)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Iterate through rows and update values
&amp;nbsp;&amp;nbsp;&amp;nbsp; i = high_id
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cur2:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row2.Sequence = i
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur2.updateRow(row2)
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Jul 2013 17:32:32 GMT</pubDate>
    <dc:creator>ionarawilson1</dc:creator>
    <dc:date>2013-07-08T17:32:32Z</dc:date>
    <item>
      <title>Sequential Number for a Number Field</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-for-a-number-field/m-p/554444#M43350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want to update a record with a sequential number. Every time the user adds a record, the sequence attribute increases by 1. So record digitized for the first time has a sequence number of 1, the second record gets a sequence number of 2, etc. The record has to be selected when this update occurs. The sequence field is of data type number, but I could create a string attribute if necessary. I tried the following but keeps getting a 1 for all the records. What am I doing wrong? Thank you!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; filter = 'NOT Sequence IS NULL' #filter for non-Null values
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur1 = arcpy.UpdateCursor("Stewardship", filter) 

# Iterate through rows and get highest ID values
&amp;nbsp;&amp;nbsp;&amp;nbsp; high_id = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row1 in cur1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if high_id &amp;lt; row1.Sequence:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; high_id = row1.Sequence


&amp;nbsp;&amp;nbsp;&amp;nbsp; filter = 'Sequence IS NULL' #filter for Null values
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur2 = arcpy.UpdateCursor("Stewardship", filter)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Iterate through rows and update values
&amp;nbsp;&amp;nbsp;&amp;nbsp; i = high_id
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cur2:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row2.Sequence = i
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur2.updateRow(row2)
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 17:32:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-for-a-number-field/m-p/554444#M43350</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-08T17:32:32Z</dc:date>
    </item>
  </channel>
</rss>

