<?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 cursor with compound where clause in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/update-cursor-with-compound-where-clause/m-p/1271997#M67240</link>
    <description>&lt;P&gt;Python is case sensitive, &lt;STRONG&gt;AND&lt;/STRONG&gt; does not exist in Python but &lt;STRONG&gt;and&lt;/STRONG&gt; does. Suggest you read this &lt;A href="https://www.w3schools.com/python/python_operators.asp" target="_self"&gt;page.&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Mar 2023 16:19:57 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2023-03-27T16:19:57Z</dc:date>
    <item>
      <title>update cursor with compound where clause</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-with-compound-where-clause/m-p/1271994#M67239</link>
      <description>&lt;P&gt;I want to run an update cursor that operates on a couple of conditions as in the following:&amp;nbsp;&lt;/P&gt;&lt;P&gt;with arcpy.da.UpdateCursor(fc,field_list) as cursor:&lt;BR /&gt;for rec in cursor:&lt;BR /&gt;&amp;nbsp;if rec[0] == 'some value' AND (rec[1]+rec[2] &amp;gt; 9):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;rec[4] = 'updated value'&lt;BR /&gt;cursor.updateRow(rec)&lt;/P&gt;&lt;P&gt;essentially, I need to update records for specific values in one field when the sum of two others are at least 1.&lt;/P&gt;&lt;P&gt;However, I keep getting a syntax error at the AND statement.&lt;/P&gt;&lt;P&gt;Bonus points if you have thoughts about looping through multiple conditions being fed into this - for instance, I have 4 different conditions to update in&amp;nbsp; the 'rec[0] ' field, each of which has a set of conditions to meet and an 'else' result. Can this be done with a dictionary perhaps?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 16:12:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-with-compound-where-clause/m-p/1271994#M67239</guid>
      <dc:creator>clt_cabq</dc:creator>
      <dc:date>2023-03-27T16:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: update cursor with compound where clause</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-with-compound-where-clause/m-p/1271997#M67240</link>
      <description>&lt;P&gt;Python is case sensitive, &lt;STRONG&gt;AND&lt;/STRONG&gt; does not exist in Python but &lt;STRONG&gt;and&lt;/STRONG&gt; does. Suggest you read this &lt;A href="https://www.w3schools.com/python/python_operators.asp" target="_self"&gt;page.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 16:19:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-with-compound-where-clause/m-p/1271997#M67240</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2023-03-27T16:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: update cursor with compound where clause</title>
      <link>https://community.esri.com/t5/python-questions/update-cursor-with-compound-where-clause/m-p/1272010#M67241</link>
      <description>&lt;P&gt;Thank you, I figured this out just now actually, some confusion on my part caused by&amp;nbsp;the reference material on the update cursor help and its reference to the 'sql reference for query expressions' help page. I also think I wasn't deploying the parentheses correctly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 16:42:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-cursor-with-compound-where-clause/m-p/1272010#M67241</guid>
      <dc:creator>clt_cabq</dc:creator>
      <dc:date>2023-03-27T16:42:23Z</dc:date>
    </item>
  </channel>
</rss>

