<?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: Sequential number based on two other fields? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290285#M22477</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Stacy, this is perfect. It worked !!! You are a genius! Thank you so much!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Jul 2013 12:29:18 GMT</pubDate>
    <dc:creator>ionarawilson1</dc:creator>
    <dc:date>2013-07-11T12:29:18Z</dc:date>
    <item>
      <title>Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290280#M22472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to create an ID that includes the year, county and sequential number. The sequential number or the county makes the id different&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if year 2013, county 001&amp;nbsp; - the sequential number is 001&amp;nbsp; and unique id is 2013-001-001&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if year 2013, county 001 - the sequential number is 002 and unique id is 2013-001-002&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If year 2014, county 001 - sequential number is 001 and unique id is 2014-001-001&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If year 2014, county 005 - sequential number is 001 and unique id is 2014-005-001&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I already have the code to calculate the sequential number but now it is just calculating the numbers from 001, 002, 003 for the fields when sorted by the sequential number field. Is there a way to create the sequential number based on year and county ? Thank you&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; &amp;nbsp; arcpy.SelectLayerByAttribute_management("Stewardship", "CLEAR_SELECTION")&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; filter = 'NOT SequenceNumber IS NULL' #filter for non-Null values &amp;nbsp;&amp;nbsp;&amp;nbsp; cur1 = arcpy.UpdateCursor("Stewardship", filter, "", "", "SequenceNumber A")&amp;nbsp;&amp;nbsp; # 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.SequenceNumber: &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.SequenceNumber&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; filter = 'SequenceNumber IS NULL' #filter for Null values &amp;nbsp;&amp;nbsp;&amp;nbsp; cur2 = arcpy.UpdateCursor("Stewardship", filter)&amp;nbsp; &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.SequenceNumber = (i) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur2.updateRow(row2)&amp;nbsp; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 19:45:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290280#M22472</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-10T19:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290281#M22473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your question is kind of confusing, but I think I know what you are after... It may replace some of the older code you have developed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Once again, a dictionary is a really handy way to solve this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Make the year/county info the key. Each time your code comes across a new year/county combo it can add it do the dictionary, and return sequential number 1. If that year/county is already in the dictionary, it can increment the value in the dictionary and return the new number...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your fields are &lt;/SPAN&gt;&lt;STRONG&gt;year &lt;/STRONG&gt;&lt;SPAN&gt;and &lt;/SPAN&gt;&lt;STRONG&gt;county&lt;/STRONG&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Iterate through rows and update values
&amp;nbsp;&amp;nbsp;&amp;nbsp; # make empty dictionary
&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict = {}
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row3 in cur3:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = str(row3.year) + '-' + str(row3.county) # use year/county as the key
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # if key already in dict, increment it; otherwise set it to a value of 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if key in sequenceDict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict[key] += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict[key] = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # our entire sequence; zfill pads the result with zeros until it is three characters in length
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row3.SequenceNumber = key + '-' + str(sequenceDict[key]).zfill(3)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur3.updateRow(row3)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:00:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290281#M22473</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2021-12-11T14:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290282#M22474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Stacey, do I keep the other cursors or I delete them? or do I delete cur2 and keep cur 1 and cur3? Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 21:16:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290282#M22474</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-10T21:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290283#M22475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Kind of depends on how many years and counties you have.&amp;nbsp; If not too many, might be best to use a dictionary and populate it with the possible lookup values to extract.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another way might be to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;create a new field for the sequencnum&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;create a new field for the new id&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;iterate through and append to a list your years and another list for counties (by number)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for year in years:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for county in counties:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.definitionQuery = "years" = year AND "counties" = county&amp;nbsp;&amp;nbsp;&amp;nbsp; # I know this isn't valid syntax, just a basic outline but would only show features in one year and county
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; maxValue = arcpy.SearchCursor(infc, "", "", "", "sequencnum D").next().getValue(sequencnum)&amp;nbsp; # this would grab the max sequencnum if exists so you know what to start with.&amp;nbsp; if no exist, then set to 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then do your update cursor and update the newid field to (str(year) + "-" + str(county)&amp;nbsp; + "-" + str(sequencenum))&amp;nbsp;&amp;nbsp; # may have to .zfill to get the zeros right.&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;something like that should "filter" the table to just one year and county at a time, then you can do the sequence number(s), then it will move onto the same year, next county, then after that year, it will do next year, first county and so on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I see Stacey posted while I was writing this.&amp;nbsp; Both methods should work, but I think Stacey's is more elegant, and probably execute faster.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:00:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290283#M22475</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T14:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290284#M22476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, I think this uniqueID (year-county-sequenceNumber) &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;replaces &lt;/STRONG&gt;&lt;SPAN&gt;the other things you were doing. As I said before, there is a lot going on in your question, so I'm not 100% sure...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;all &lt;/STRONG&gt;&lt;SPAN&gt;you want is this uniqueID (and it is in a text field called uniqueID) this should be all you need:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management("Stewardship", "CLEAR_SELECTION")&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; cur = arcpy.UpdateCursor("Stewardship")&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; # Iterate through rows and update values &amp;nbsp;&amp;nbsp;&amp;nbsp; # make empty dictionary &amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict = {} &amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cur: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = str(row.year) + '-' + str(row.county) # use year/county as the key &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # if key already in dict, increment it; otherwise set it to a value of 1 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if key in sequenceDict: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict[key] += 1 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict[key] = 1 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # entire uniqueID; zfill pads the result with zeros until it is three characters in length &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.uniqueID = key + '-' + str(sequenceDict[key]).zfill(3) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.updateRow(row)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 00:01:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290284#M22476</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2013-07-11T00:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290285#M22477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Stacy, this is perfect. It worked !!! You are a genius! Thank you so much!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 12:29:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290285#M22477</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-11T12:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290286#M22478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Stacy, there is only one issue. If for example I delete one 3266-045-009 and create another polygon and run the tool again, the value 3266-045-010 will become 3266-045-009 and the one I just created will become 3266-045-010. Is there a way to make the uniqueID permanent? Thanks again!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 12:41:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290286#M22478</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-11T12:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290287#M22479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Basically, it would look at the highest value for that unique id and create the new PlanID from there.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 13:50:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290287#M22479</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-11T13:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290288#M22480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Kind of depends on how many years and counties you have.&amp;nbsp; If not too many, might be best to use a dictionary and populate it with the possible lookup values to extract.&lt;BR /&gt;&lt;BR /&gt;Another way might be to:&lt;BR /&gt;&lt;BR /&gt;create a new field for the sequencnum&lt;BR /&gt;create a new field for the new id&lt;BR /&gt;&lt;BR /&gt;iterate through and append to a list your years and another list for counties (by number)&lt;BR /&gt;&lt;BR /&gt;Then something like:&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for year in years:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for county in counties:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.definitionQuery = "years" = year AND "counties" = county&amp;nbsp;&amp;nbsp;&amp;nbsp; # I know this isn't valid syntax, just a basic outline but would only show features in one year and county
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; maxValue = arcpy.SearchCursor(infc, "", "", "", "sequencnum D").next().getValue(sequencnum)&amp;nbsp; # this would grab the max sequencnum if exists so you know what to start with.&amp;nbsp; if no exist, then set to 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then do your update cursor and update the newid field to (str(year) + "-" + str(county)&amp;nbsp; + "-" + str(sequencenum))&amp;nbsp;&amp;nbsp; # may have to .zfill to get the zeros right.&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;something like that should "filter" the table to just one year and county at a time, then you can do the sequence number(s), then it will move onto the same year, next county, then after that year, it will do next year, first county and so on.&lt;BR /&gt;&lt;BR /&gt;R_&lt;BR /&gt;&lt;BR /&gt;I see Stacey posted while I was writing this.&amp;nbsp; Both methods should work, but I think Stacey's is more elegant, and probably execute faster.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; Rhett, Can you please elaborate on this? Do I create a search cursor first to create the lists? How do I create the lists? Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:00:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290288#M22480</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2021-12-11T14:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290289#M22481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried to combine what I had before (sorting by the highest value) with what Stacy has written. But I am getting an error at the end: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback Info:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "D:\ArcGISData\SARS\Python_10April2013\BoundaryReporting_26March2013_changes_july2013_added_domain_changed_again.py", line 234, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.PlanID = key + '-' + str(sequenceDict2[key]).zfill(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Error Info:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;type 'exceptions.RuntimeError'&amp;gt;: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anybody know why? Thank you!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp; filter = 'NOT SequenceNumber IS NULL' #filter for non-Null values
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur1 = arcpy.UpdateCursor("Stewardship", filter, "", "", "SequenceNumber A")

# Iterate through rows and get highest ID values

&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict = {}
&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 sequenceDict &amp;lt; row1.PlanID:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict = row1.PlanID


&amp;nbsp;&amp;nbsp;&amp;nbsp; filter = 'SequenceNumber 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; sequenceDict2 = {}
&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2 = sequenceDict
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cur2:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = str(row2.FFY) + '-' + str(row2.County) # use year/county as the key
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (key in sequenceDict2):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2[key] += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict[key] = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.PlanID = key + '-' + str(sequenceDict2[key]).zfill(3)
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur2.updateRow(row2)

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:00:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290289#M22481</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2021-12-11T14:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290290#M22482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, would use a searchcursor to populate the lists.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Somthing like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
yearList = []
countyList = []

with da.SearchCursor(inFc,["years","counties"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year= str(row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; county = str(row[1])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yearList.append(year)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; countyList.append(county)
del cursor
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course, this will have the same issue, as if you delete one row (if it was the highest sequence number), the next time the maxValue searchcursor is run on it, the "old" number would be the "new" maxValue again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, in the code I provide previously, I should not have put the maxValue SearchCursor within the loop.&amp;nbsp; It is hardcoded to the FC and fields, so no need to run that process each time.&amp;nbsp; would move that just above the loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:00:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290290#M22482</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T14:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290291#M22483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; I tried to combine what I had before (sorting by the highest value) with what Stacy has written. But I am getting an error at the end:&amp;nbsp;&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;Traceback Info:&amp;nbsp; &lt;BR /&gt; File "D:\ArcGISData\SARS\Python_10April2013\BoundaryReporting_26March2013_changes_july2013_added_domain_changed_again.py", line 234, in &amp;lt;module&amp;gt;&amp;nbsp; &lt;BR /&gt; row.PlanID = key + '-' + str(sequenceDict2[key]).zfill(3)&amp;nbsp; &lt;BR /&gt;Error Info:&amp;nbsp; &lt;BR /&gt; &amp;lt;type 'exceptions.RuntimeError'&amp;gt;: ERROR 999999: Error executing function.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;Does anybody know why? Thank you!!!&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp; filter = 'NOT SequenceNumber IS NULL' #filter for non-Null values
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur1 = arcpy.UpdateCursor("Stewardship", filter, "", "", "SequenceNumber A")

# Iterate through rows and get highest ID values

&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict = {}
&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 sequenceDict &amp;lt; row1.PlanID:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict = row1.PlanID


&amp;nbsp;&amp;nbsp;&amp;nbsp; filter = 'SequenceNumber 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; sequenceDict2 = {}
&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2 = sequenceDict
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cur2:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = str(row2.FFY) + '-' + str(row2.County) # use year/county as the key
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (key in sequenceDict2):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2[key] += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict[key] = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.PlanID = key + '-' + str&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;(&lt;/SPAN&gt;(sequenceDict2[key]).zfill(3)&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur2.updateRow(row2)

&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does the change in red above get rid of the error?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:00:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290291#M22483</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T14:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290292#M22484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No, the problem was with something else. Can you please look at this code and tell me why I get the following error message, but I dont't get an error when I run Stacy's original code?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback Info:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "D:\ArcGISData\SARS\Python_10April2013\BoundaryReporting_26March2013_changes_july2013_added_domain_changed_again.py", line 260, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2[key] = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Error Info:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;type 'exceptions.TypeError'&amp;gt;: 'unicode' object does not support item assignment&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Iterate through rows and get highest ID values

&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict = {}
&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 sequenceDict &amp;lt; row1.PlanID:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("TEST")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict = row1.PlanID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(sequenceDict)

&amp;nbsp;&amp;nbsp;&amp;nbsp; filter = 'SequenceNumber 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; sequenceDict2 = {}
&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2 = sequenceDict
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(sequenceDict2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cur2:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = str(row2.FFY) + '-' + str(row2.County) # use year/county as the key
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (key in sequenceDict2):

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2[key] += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2[key] = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; row2.PlanID = key + '-' + str(sequenceDict2[key]).zfill(3)
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur2.updateRow(row2)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:00:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290292#M22484</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2021-12-11T14:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290293#M22485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; No, the problem was with something else. Can you please look at this code and tell me why I get the following error message, but I dont't get an error when I run Stacy's original code?&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;Traceback Info:&amp;nbsp; &lt;BR /&gt; File "D:\ArcGISData\SARS\Python_10April2013\BoundaryReporting_26March2013_changes_july2013_added_domain_changed_again.py", line 260, in &amp;lt;module&amp;gt;&amp;nbsp; &lt;BR /&gt; sequenceDict2[key] = 1&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;Error Info:&amp;nbsp; &lt;BR /&gt; &amp;lt;type 'exceptions.TypeError'&amp;gt;: 'unicode' object does not support item assignment&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Iterate through rows and get highest ID values

&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict = {}
&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 sequenceDict&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;[key]&lt;/SPAN&gt; &amp;lt; row1.PlanID:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("TEST")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;[key]&lt;/SPAN&gt; = row1.PlanID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(sequenceDict)

&amp;nbsp;&amp;nbsp;&amp;nbsp; filter = 'SequenceNumber 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; sequenceDict2 = {}
&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2 = sequenceDict
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(sequenceDict2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cur2:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = str(row2.FFY) + '-' + str(row2.County) # use year/county as the key
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (key in sequenceDict2):

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2[key] += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sequenceDict2[key] = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; row2.PlanID = key + '-' + str(sequenceDict2[key]).zfill(3)
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur2.updateRow(row2)
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I suspect it is related to trying to compare an entire dictionary to a value, then set the entire dict to a value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Need to have key:value pair for the dict. So, sequenceDict = row1.PlanID would now overwite the setting of sequenceDict as a dictionary and now assigns it as a variable with row1.PlanID as the value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then later, you set sequenceDict2 equal to a variable (not a dict) and try to use it as a dict ( sequenceDict2[key] = 1).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:00:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290293#M22485</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T14:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290294#M22486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Rhett. I need to go back to my original code and try to figure out from there how to create the unique value by county and year. Thanks again!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 19:34:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290294#M22486</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-11T19:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290295#M22487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Stacy, there is only one issue. If for example I delete one 3266-045-009 and create another polygon and run the tool again, the value 3266-045-010 will become 3266-045-009 and the one I just created will become 3266-045-010. Is there a way to make the uniqueID permanent? Thanks again!!!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The script just creates the UniqueID based on the set passed to it. There is no simple way to make it permanent, apart from never running the script again...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only ways that come to mind for making it permanent would be by using some kind of version control...? I don't really know. It ought to be possible to do something by writing/reading information to/from a text file, but that would be a lot of work to program.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you looked into Geodatabase versioning tools? I don't know if they will help you, but they might...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 20:13:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290295#M22487</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2013-07-11T20:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290296#M22488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Basically, it would look at the highest value for that unique id and create the new PlanID from there.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What is PlanID?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When you delete a feature its information disappears. You no longer are able to use it as the basis for a calculation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think you need to step back from the problem for a minute and try to figure out &lt;/SPAN&gt;&lt;STRONG&gt;exactly &lt;/STRONG&gt;&lt;SPAN&gt;what you are trying to do. This is a normal part of programming complex things. Get a piece of paper and write/draw all the information you have, then think about how you can get the output you require. For example, the answer I posted earlier was basically:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;increment counter whenever a value of column1+column2 appears
write colum1+column2+counter to column3&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;This is called pseudo-code. If you can write a pseudo-code that works on paper (or, say, in Excel) then you can program it. Without doing this process you are stabbing in the dark.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:00:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290296#M22488</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2021-12-11T14:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290297#M22489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I tried to combine what I had before (sorting by the highest value) with what Stacy has written. But I am getting an error at the end: &lt;BR /&gt;&lt;BR /&gt;Traceback Info:&lt;BR /&gt;&amp;nbsp; File "D:\ArcGISData\SARS\Python_10April2013\BoundaryReporting_26March2013_changes_july2013_added_domain_changed_again.py", line 234, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.PlanID = key + '-' + str(sequenceDict2[key]).zfill(3)&lt;BR /&gt;&lt;BR /&gt;Error Info:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;type 'exceptions.RuntimeError'&amp;gt;: ERROR 999999: Error executing function.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Does anybody know why? Thank you!!!&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would guess that PlanID is not a text field...? Everything else looks OK.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 20:25:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290297#M22489</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2013-07-11T20:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290298#M22490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Stacy, I created a workflow but since I am such a newbie I still need help. Thanks!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 17:58:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290298#M22490</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-15T17:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sequential number based on two other fields?</title>
      <link>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290299#M22491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Rhett and Stacy for your great help! I figure out a way to do it and it is working perfectly. If we delete the record, the other records don't get overwritten. I will soon post the solution after I clean up my code a little. I appreciate your help and patience!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 18:14:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sequential-number-based-on-two-other-fields/m-p/290299#M22491</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-16T18:14:02Z</dc:date>
    </item>
  </channel>
</rss>

