<?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: Please Help: Python Script to Automatically add Unique IDs to new features in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84083#M6637</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That would be my luck .. thank you! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I think your indentation might be off&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
import string

env.workspace = "C:\\Users\\gisadmin\\Desktop\\TEST"

filter = ''

cur = arcpy.UpdateCursor("C:\\Users\\gisadmin\\Desktop\\TEST\\FH_Test.shp", filter)

i = 0
for row in cur:
&amp;nbsp;&amp;nbsp;&amp;nbsp; i += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.FACILITY_I = str(i) #This is the label for the column you want to update, eg. OID
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;cur.updateRow(row)&lt;/STRONG&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 23:13:26 GMT</pubDate>
    <dc:creator>ChristinaGnadinger</dc:creator>
    <dc:date>2021-12-10T23:13:26Z</dc:date>
    <item>
      <title>Please Help: Python Script to Automatically add Unique IDs to new features</title>
      <link>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84081#M6635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I found a script on here, somewhere, and have been trying to edit it for my purposes. Right now I'm trying to test it out on a sample on my local computer to make sure it will work before attempting anything more. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ultimately, I am trying to set up a script to run through the Scheduled Tasks that will go through a series of SDE datasets and assign unique IDs to the newly added features. I actually want it to assign the unique ID as a letter/number combination (i.e. FH0003001) but at the moment I can't get the simple number part to work in my favor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(I'm coming from the VB side and still very green with Python.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I've been trying to use so far, however I am getting the error that says "return convertArcObjectToPythonObject(self._arc_object.UpdateRow(*gp_fixargs(args)))" RuntimeError: ERROR 999999: Error executing function&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, any guidance you can offer both with this sample set and in moving forward to my ultimate goal would be greatly appreciated! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
from arcpy import env
import string

env.workspace = "C:\\Users\\gisadmin\\Desktop\\TEST"

filter = '' 

cur = arcpy.UpdateCursor("C:\\Users\\gisadmin\\Desktop\\TEST\\FH_Test.shp", filter)

i = 0
for row in cur:
&amp;nbsp;&amp;nbsp;&amp;nbsp; i += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.FACILITY_I = str(i) #This is the label for the column you want to update, eg. OID

cur.updateRow(row)
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As far as this: C:\\Users\\gisadmin\\Desktop\\TEST\\FH_Test.shp I've done it with \\ and with \ .. I read somewhere about the \t causing an issue but regardless it hasn't worked either way.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Oct 2011 13:51:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84081#M6635</guid>
      <dc:creator>ChristinaGnadinger</dc:creator>
      <dc:date>2011-10-12T13:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Please Help: Python Script to Automatically add Unique IDs to new features</title>
      <link>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84082#M6636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think your indentation might be off&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
import string

env.workspace = "C:\\Users\\gisadmin\\Desktop\\TEST"

filter = ''

cur = arcpy.UpdateCursor("C:\\Users\\gisadmin\\Desktop\\TEST\\FH_Test.shp", filter)

i = 0
for row in cur:
&amp;nbsp;&amp;nbsp;&amp;nbsp; i += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.FACILITY_I = str(i) #This is the label for the column you want to update, eg. OID
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;cur.updateRow(row)&lt;/STRONG&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:13:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84082#M6636</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-10T23:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Please Help: Python Script to Automatically add Unique IDs to new features</title>
      <link>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84083#M6637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That would be my luck .. thank you! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I think your indentation might be off&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
import string

env.workspace = "C:\\Users\\gisadmin\\Desktop\\TEST"

filter = ''

cur = arcpy.UpdateCursor("C:\\Users\\gisadmin\\Desktop\\TEST\\FH_Test.shp", filter)

i = 0
for row in cur:
&amp;nbsp;&amp;nbsp;&amp;nbsp; i += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.FACILITY_I = str(i) #This is the label for the column you want to update, eg. OID
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;cur.updateRow(row)&lt;/STRONG&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:13:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84083#M6637</guid>
      <dc:creator>ChristinaGnadinger</dc:creator>
      <dc:date>2021-12-10T23:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: Please Help: Python Script to Automatically add Unique IDs to new features</title>
      <link>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84084#M6638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As an additional note, Python has a built-in function for adding loop counters to iterations, &lt;/SPAN&gt;&lt;STRONG&gt;enumerate()&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, you could even write your example as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
import string

env.workspace = "C:\\Users\\gisadmin\\Desktop\\TEST"
filter = ''
cur = arcpy.UpdateCursor("C:\\Users\\gisadmin\\Desktop\\TEST\\FH_Test.shp", filter)

for i, row in enumerate(cur):
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.FACILITY_I = str(i) #This is the label for the column you want to update, eg. OID
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.updateRow(row)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:13:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84084#M6638</guid>
      <dc:creator>MarcNakleh</dc:creator>
      <dc:date>2021-12-10T23:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Please Help: Python Script to Automatically add Unique IDs to new features</title>
      <link>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84085#M6639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Christina,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you have success with your script?&amp;nbsp; I'm in need of exactly the same thing: a script to auto-generate unique IDs that are a letter+number combo.&amp;nbsp; If so, would you mind sharing your code and/or lessons learned?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;peter[dot]palacios[at]yahoo[dot]com&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for your time and courtesy.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 14:17:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84085#M6639</guid>
      <dc:creator>PeterPalacios</dc:creator>
      <dc:date>2011-10-26T14:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Please Help: Python Script to Automatically add Unique IDs to new features</title>
      <link>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84086#M6640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Christina,&lt;BR /&gt;&lt;BR /&gt;Did you have success with your script?&amp;nbsp; I'm in need of exactly the same thing: a script to auto-generate unique IDs that are a letter+number combo.&amp;nbsp; If so, would you mind sharing your code and/or lessons learned?&lt;BR /&gt;&lt;BR /&gt;peter[dot]palacios[at]yahoo[dot]com&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for your time and courtesy.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;See &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/2937-auto-sequential-numbers-with-python?p=142516#post142516"&gt;this post&lt;/A&gt;&lt;SPAN&gt; for the code that worked for her.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 14:36:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/please-help-python-script-to-automatically-add/m-p/84086#M6640</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2011-10-26T14:36:22Z</dc:date>
    </item>
  </channel>
</rss>

