<?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: Using Where_clause with UpdateCursor and SearchCursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-where-clause-with-updatecursor-and/m-p/483931#M37785</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It seems this is incomplete code?&amp;nbsp; No imports not sure if something else that handles this is missing as well. Also the no indenting makes this block a little hard to read with all the for loops, for me anyways. And what specific error are you getting?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I think you want is a getValue in there, something like...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
cur = arcpy.SearchCursor(data)
feature = cur.next()
for feature in cur:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cod= feature.getValue("HSMU")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature = cur.next()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:21:03 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2021-12-11T21:21:03Z</dc:date>
    <item>
      <title>Using Where_clause with UpdateCursor and SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/using-where-clause-with-updatecursor-and/m-p/483930#M37784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Could you give me an example for using a Where_clause with UpdateCursor?I need to iterate for all features with the same code in a multipart FeatureClass.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an example that&amp;nbsp; doesn???t work to me:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;codici=[]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cur = arcpy.SearchCursor(data)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for feature in cur:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cod = feature.HSMU&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; codici.append(cod)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for i in range(len(codici)):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cod = codici&lt;I&gt;&lt;/I&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where_clause = "[HSMU] = "+codici&lt;I&gt;&lt;/I&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; upcur = arcpy.UpdateCursor(multidata,where_clause,'','','')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for feature in upcur:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = arcpy.GetCount_management(multidata)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2011 08:38:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-where-clause-with-updatecursor-and/m-p/483930#M37784</guid>
      <dc:creator>GraziaZulian</dc:creator>
      <dc:date>2011-03-03T08:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using Where_clause with UpdateCursor and SearchCursor</title>
      <link>https://community.esri.com/t5/python-questions/using-where-clause-with-updatecursor-and/m-p/483931#M37785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It seems this is incomplete code?&amp;nbsp; No imports not sure if something else that handles this is missing as well. Also the no indenting makes this block a little hard to read with all the for loops, for me anyways. And what specific error are you getting?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I think you want is a getValue in there, something like...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
cur = arcpy.SearchCursor(data)
feature = cur.next()
for feature in cur:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cod= feature.getValue("HSMU")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature = cur.next()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:21:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-where-clause-with-updatecursor-and/m-p/483931#M37785</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T21:21:03Z</dc:date>
    </item>
  </channel>
</rss>

