<?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: Update attribute table using Arcpy in ArcAPI Questions</title>
    <link>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823179#M58</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would help if you edit you post and post the code using &lt;A href="https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet?sr=search&amp;amp;searchId=a8d8fb1f-5622-4402-bb65-833b791e21e9&amp;amp;searchIndex=6"&gt;https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet?sr=search&amp;amp;searchId=a8d8fb1f-5622-4402-bb65-833b791e21e9&amp;amp;searchIndex=6&lt;/A&gt;‌&amp;nbsp; or &lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting?sr=search&amp;amp;searchId=a483b6b2-88cf-4672-bb4a-703edf98fba9&amp;amp;searchIndex=1"&gt;/blogs/dan_patterson/2016/08/14/script-formatting?sr=search&amp;amp;searchId=a483b6b2-88cf-4672-bb4a-703edf98fba9&amp;amp;searchIndex=1&lt;/A&gt;‌&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I see right off in what you post, assuming the spacing is how you are trying to use it, is all the lines that are indented (line 2 down) shouldn't be, until you get to the "for row in cursor:"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then some of the lines below that might need to be.&amp;nbsp; I did not look at the entire code, but fixing the indentation is probably the first step (again, assuming the spacing shown is what you are trying to use).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Nov 2017 19:39:26 GMT</pubDate>
    <dc:creator>RebeccaStrauch__GISP</dc:creator>
    <dc:date>2017-11-15T19:39:26Z</dc:date>
    <item>
      <title>Update attribute table using Arcpy</title>
      <link>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823175#M54</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;This&amp;nbsp; python code seems to work for updating&amp;nbsp; two tables saw it online, with my low arcpy code skills&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This seem to update the two tables&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;... from arcpy import env&lt;BR /&gt;... env.workspace = "C:\Users\L0505857\Data"&lt;BR /&gt;... print 'Processing...'&lt;BR /&gt;... fc = "Updated_subset.dbf"&lt;BR /&gt;... cursor = arcpy.da.SearchCursor(fc, ["RESID"])&lt;BR /&gt;... for row in cursor:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SQL_stat= "RESID = "+ str(row[0])&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc2 = "airports_old.dbf"&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor2 = arcpy.da.SearchCursor(fc, ["FIELD_NAME"], SQL_stat)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cursor2:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UpdatedValue = row2[0]&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor3 = arcpy.da.UpdateCursor(fc2, ["FIELD_NAME"],SQL_stat)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row3 in cursor3:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row3[0] = UpdatedValue&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor3.updateRow(row3)&lt;BR /&gt;... del row&lt;BR /&gt;... del cursor&lt;BR /&gt;... del row2&lt;BR /&gt;... del cursor2&lt;BR /&gt;... del row3&lt;BR /&gt;... del cursor3&lt;BR /&gt;... &lt;BR /&gt;... print "Done"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thisSQL_stat line ---SQL_stat= "RESID = "+ str(row[0])&lt;/P&gt;&lt;P&gt;converts the&amp;nbsp; unique ID field&amp;nbsp; "RESID&amp;nbsp; Field" &amp;nbsp;to string.&lt;/P&gt;&lt;P&gt;How do I remove the str for a another table&amp;nbsp; in which the RESID field is already a string and not an interger field?&lt;/P&gt;&lt;P&gt;&amp;nbsp;SQL_stat= "RESID = "+ (row[0])&lt;/P&gt;&lt;P&gt;tried the line above without the str, I m getting errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 17:18:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823175#M54</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-15T17:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Update attribute table using Arcpy</title>
      <link>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823176#M55</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sharing with &lt;A href="https://community.esri.com/community/developers/gis-developers/python?sr=search&amp;amp;searchId=b4b17813-e9e5-48eb-89bc-3ea7c4ab364e&amp;amp;searchIndex=1"&gt;https://community.esri.com/community/developers/gis-developers/python?sr=search&amp;amp;searchId=b4b17813-e9e5-48eb-89bc-3ea7c4ab364e&amp;amp;searchIndex=1&lt;/A&gt;‌ since this is an ArcPy question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 17:51:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823176#M55</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-11-15T17:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Update attribute table using Arcpy</title>
      <link>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823177#M56</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Include the full error message. There shouldn't be a problem trying to cast an existing string to a string (e.g. str("my_string")).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 18:15:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823177#M56</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2017-11-15T18:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Update attribute table using Arcpy</title>
      <link>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823178#M57</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you are creating an SQL&amp;nbsp;where clause, you may need the string in quotes for comparison.&amp;nbsp; It may be helpful to use something like:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; row &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;123&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"hello"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; sql &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"RESID = {}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# for numbers&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; sql
&lt;SPAN class="string token"&gt;'RESID = 123'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; sql &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"RESID = '{}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# for strings&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; sql
&lt;SPAN class="string token"&gt;"RESID = 'hello'"&lt;/SPAN&gt;‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:47:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823178#M57</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-12T09:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Update attribute table using Arcpy</title>
      <link>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823179#M58</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would help if you edit you post and post the code using &lt;A href="https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet?sr=search&amp;amp;searchId=a8d8fb1f-5622-4402-bb65-833b791e21e9&amp;amp;searchIndex=6"&gt;https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet?sr=search&amp;amp;searchId=a8d8fb1f-5622-4402-bb65-833b791e21e9&amp;amp;searchIndex=6&lt;/A&gt;‌&amp;nbsp; or &lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting?sr=search&amp;amp;searchId=a483b6b2-88cf-4672-bb4a-703edf98fba9&amp;amp;searchIndex=1"&gt;/blogs/dan_patterson/2016/08/14/script-formatting?sr=search&amp;amp;searchId=a483b6b2-88cf-4672-bb4a-703edf98fba9&amp;amp;searchIndex=1&lt;/A&gt;‌&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I see right off in what you post, assuming the spacing is how you are trying to use it, is all the lines that are indented (line 2 down) shouldn't be, until you get to the "for row in cursor:"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then some of the lines below that might need to be.&amp;nbsp; I did not look at the entire code, but fixing the indentation is probably the first step (again, assuming the spacing shown is what you are trying to use).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 19:39:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823179#M58</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-11-15T19:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Update attribute table using Arcpy</title>
      <link>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823180#M59</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; &lt;SPAN style="color: #004da8;"&gt;import&lt;/SPAN&gt; arcpy&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;from&lt;/SPAN&gt; arcpy &lt;SPAN style="color: #004da8;"&gt;import&lt;/SPAN&gt; env&lt;/P&gt;&lt;P&gt;... env.workspace = "C:\Data"&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;print&lt;/SPAN&gt; 'Processing...'&lt;/P&gt;&lt;P&gt;... fc = "Updated_subset.dbf"&lt;/P&gt;&lt;P&gt;... cursor = arcpy.da.SearchCursor(fc, ["RESID"])&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;for&lt;/SPAN&gt; row &lt;SPAN style="color: #004da8;"&gt;in&lt;/SPAN&gt; cursor:&lt;/P&gt;&lt;P&gt;... SQL_stat= "RESID = "+ str(row[0])&lt;/P&gt;&lt;P&gt;... fc2 = "airports_old.dbf"&lt;/P&gt;&lt;P&gt;... cursor2 = arcpy.da.SearchCursor(fc, ["Regional_s"], SQL_stat)&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;for&lt;/SPAN&gt; row2 &lt;SPAN style="color: #004da8;"&gt;in&lt;/SPAN&gt; cursor2:&lt;/P&gt;&lt;P&gt;... UpdatedValue = row2[0]&lt;/P&gt;&lt;P&gt;... cursor3 = arcpy.da.UpdateCursor(fc2, ["Regional_s"],SQL_stat)&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;for&lt;/SPAN&gt; row3 &lt;SPAN style="color: #004da8;"&gt;in&lt;/SPAN&gt; cursor3:&lt;/P&gt;&lt;P&gt;... row3[0] = UpdatedValue&lt;/P&gt;&lt;P&gt;... cursor3.updateRow(row3)&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;del&lt;/SPAN&gt; row&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;del&lt;/SPAN&gt; cursor&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;del&lt;/SPAN&gt; row2&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;del&lt;/SPAN&gt; cursor2&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;del&lt;/SPAN&gt; row3&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;del&lt;/SPAN&gt; cursor3&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;print&lt;/SPAN&gt; "Done"&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Processing...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runtime error&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;File "&amp;lt;string&amp;gt;", line 11, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;RuntimeError: A column was specified that does not exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see the runtime error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 09:16:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcapi-questions/update-attribute-table-using-arcpy/m-p/823180#M59</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-16T09:16:24Z</dc:date>
    </item>
  </channel>
</rss>

