<?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 UpdateCursor not updating attributes in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/updatecursor-not-updating-attributes/m-p/352651#M2254</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using ArcCafe's shiftfeature example and it is working great for shifting the shape.&amp;nbsp; However I want to add an update to one of the attributes and that is not working.&amp;nbsp; Here is my code.&amp;nbsp; The script runs fine and acts like it's working but when I go into the attribute table after running it non of my keynumbers show up...all are still null.&amp;nbsp; What am I doing wrong? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def shift_features(in_features,&amp;nbsp; keynumber, x_shift=None, y_shift=None):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ikeynumber = int(keynumber)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(in_features, ['SHAPE@XY','KEYNUMBER']) as cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/P&gt;&lt;P&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; cursor.updateRow([[row[0][0] + (x_shift or 0),&lt;/P&gt;&lt;P&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0][1] + (y_shift or 0)], ikeynumber])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Oct 2014 14:56:31 GMT</pubDate>
    <dc:creator>Hernando_CountyProperty_Apprai</dc:creator>
    <dc:date>2014-10-13T14:56:31Z</dc:date>
    <item>
      <title>UpdateCursor not updating attributes</title>
      <link>https://community.esri.com/t5/developers-questions/updatecursor-not-updating-attributes/m-p/352651#M2254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using ArcCafe's shiftfeature example and it is working great for shifting the shape.&amp;nbsp; However I want to add an update to one of the attributes and that is not working.&amp;nbsp; Here is my code.&amp;nbsp; The script runs fine and acts like it's working but when I go into the attribute table after running it non of my keynumbers show up...all are still null.&amp;nbsp; What am I doing wrong? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def shift_features(in_features,&amp;nbsp; keynumber, x_shift=None, y_shift=None):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ikeynumber = int(keynumber)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(in_features, ['SHAPE@XY','KEYNUMBER']) as cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/P&gt;&lt;P&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; cursor.updateRow([[row[0][0] + (x_shift or 0),&lt;/P&gt;&lt;P&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0][1] + (y_shift or 0)], ikeynumber])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 14:56:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/updatecursor-not-updating-attributes/m-p/352651#M2254</guid>
      <dc:creator>Hernando_CountyProperty_Apprai</dc:creator>
      <dc:date>2014-10-13T14:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor not updating attributes</title>
      <link>https://community.esri.com/t5/developers-questions/updatecursor-not-updating-attributes/m-p/352652#M2255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priscilla,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your script looks correct.&amp;nbsp; What type of field is KEYNUMBER?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try removing the XY update and see if you are able to just update this field.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14132146193568842" jivemacro_uid="_14132146193568842"&gt;
&lt;P&gt;def shift_features(in_features, keynumber):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ikeynumber = int(keynumber)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(in_features, ['KEYNUMBER']) as cursor:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([ikeynumber])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 15:37:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/updatecursor-not-updating-attributes/m-p/352652#M2255</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2014-10-13T15:37:10Z</dc:date>
    </item>
  </channel>
</rss>

