<?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: Selecting multiple attributes from the same column using where_clause in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358112#M28290</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV data-object-id="193743" data-object-type="1"&gt;&lt;DIV data-jive-view="apps/content/questions/correct_view"&gt;&lt;DIV&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&lt;STRONG style="font-weight: bold;"&gt;DrainClass Like %drained%' &amp;nbsp;&lt;/STRONG&gt;if there are only 2&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&lt;STRONG&gt;Title = 'Actor' OR Title = 'Advisor'&lt;/STRONG&gt; &amp;nbsp; &amp;nbsp; good... no typing involved, select the field, the OR and the case&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&lt;STRONG&gt;(Title = 'Actor') OR (Title = 'Advisor')&lt;/STRONG&gt; &amp;nbsp; better, no typing, paying attention that conditionals are surround in ( )'s&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Apr 2017 02:36:48 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2017-04-21T02:36:48Z</dc:date>
    <item>
      <title>Selecting multiple attributes from the same column using where_clause</title>
      <link>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358110#M28288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I am really green in this, but&amp;nbsp;&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;I am having trouble using &lt;/SPAN&gt;&lt;STRONG style="color: #333333; background-color: #ffffff; font-weight: bold;"&gt;where_clause&lt;/STRONG&gt;&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt; to select two types two different types of attributes within the same column using the Select(analysis) tool with arcpy.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;The way I &amp;nbsp;do it regularly using&amp;nbsp;&lt;STRONG style="font-weight: bold;"&gt;Select by Attributes&lt;/STRONG&gt;&amp;nbsp;windows is the following&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&lt;STRONG style="font-weight: bold;"&gt;DrainClass = 'Somewhat excessively drained' OR DrainClass = 'Well drained'&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;I have tried using double quotations on the outside, but I keep getting an&amp;nbsp;ExecuteError&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&lt;STRONG style="font-weight: bold;"&gt;ExecuteError&lt;/STRONG&gt;: ERROR 000358: Invalid expression&amp;nbsp;DrainClass = 'Somewhat excessively drained' OR DrainClass = 'Well drained'&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;Does anyone know how to&amp;nbsp;set the correct expression in arcpy?&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2017 02:13:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358110#M28288</guid>
      <dc:creator>CristianLa_Rosa1</dc:creator>
      <dc:date>2017-04-21T02:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple attributes from the same column using where_clause</title>
      <link>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358111#M28289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is helpful if you can post the exact code you are using to call the function/tool.&amp;nbsp; Post a couple examples if you have tried them and they all fail.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2017 02:21:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358111#M28289</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-04-21T02:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple attributes from the same column using where_clause</title>
      <link>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358112#M28290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV data-object-id="193743" data-object-type="1"&gt;&lt;DIV data-jive-view="apps/content/questions/correct_view"&gt;&lt;DIV&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&lt;STRONG style="font-weight: bold;"&gt;DrainClass Like %drained%' &amp;nbsp;&lt;/STRONG&gt;if there are only 2&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&lt;STRONG&gt;Title = 'Actor' OR Title = 'Advisor'&lt;/STRONG&gt; &amp;nbsp; &amp;nbsp; good... no typing involved, select the field, the OR and the case&lt;/P&gt;&lt;P style="margin: 0px 0px 2px;"&gt;&lt;STRONG&gt;(Title = 'Actor') OR (Title = 'Advisor')&lt;/STRONG&gt; &amp;nbsp; better, no typing, paying attention that conditionals are surround in ( )'s&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2017 02:36:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358112#M28290</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-04-21T02:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple attributes from the same column using where_clause</title>
      <link>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358113#M28291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I ran&lt;SPAN style="color: #333333; background-color: #f6f7f6;"&gt;&amp;nbsp;the code using the Select (analysis) tool, then copied the python code snippet from the results window and this is what it said&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="" style="background: -webkit-linear-gradient(top, #f8f8f9 0%, #ecf0f3 100%) padding-box #f6f7f6; border: 1px solid #c6c9cc; margin: 8px; padding: 10px;"&gt;&lt;SPAN class="" style="color: #000000;"&gt;where_clause1&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #008800;"&gt;""""&lt;/SPAN&gt;&lt;SPAN class="" style="color: #660066;"&gt;DrainClass&lt;/SPAN&gt;&lt;SPAN class="" style="color: #008800;"&gt;" = 'Well drained' OR "&lt;/SPAN&gt;&lt;SPAN class="" style="color: #660066;"&gt;DrainClass&lt;/SPAN&gt;&lt;SPAN class="" style="color: #008800;"&gt;" = 'Somewhat excessively drained'"""&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="background: -webkit-linear-gradient(top, #f8f8f9 0%, #ecf0f3 100%) padding-box #f6f7f6; border: 1px solid #c6c9cc; margin: 8px; padding: 10px;"&gt;&lt;SPAN class="" style="color: #000000;"&gt;greatSoiloutput &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #008800;"&gt;"greatSoils.shp"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #000000;"&gt;where_clause1&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #008800;"&gt;""""&lt;/SPAN&gt;&lt;SPAN class="" style="color: #660066;"&gt;DrainClass&lt;/SPAN&gt;&lt;SPAN class="" style="color: #008800;"&gt;" = 'Well drained' OR "&lt;/SPAN&gt;&lt;SPAN class="" style="color: #660066;"&gt;DrainClass&lt;/SPAN&gt;&lt;SPAN class="" style="color: #008800;"&gt;" = 'Somewhat excessively drained'"""&lt;/SPAN&gt;&lt;SPAN class="" style="color: #000000;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #660066;"&gt;Select_analysis&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #000000;"&gt;bigSoils&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #000000;"&gt; greatSoiloutput&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #000000;"&gt; where_clause1&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666600;"&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #f6f7f6;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2017 22:57:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358113#M28291</guid>
      <dc:creator>CristianLa_Rosa1</dc:creator>
      <dc:date>2017-04-21T22:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple attributes from the same column using where_clause</title>
      <link>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358114#M28292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry I am very new at this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2017 22:58:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358114#M28292</guid>
      <dc:creator>CristianLa_Rosa1</dc:creator>
      <dc:date>2017-04-21T22:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple attributes from the same column using where_clause</title>
      <link>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358115#M28293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;greatSoiloutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"greatSoils.shp"&lt;/SPAN&gt;
where_clause1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"""
"DrainClass" = 'Well drained' OR "DrainClass" = 'Somewhat excessively drained'
"""&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Select_analysis&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;bigSoils&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; greatSoiloutput&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; where_clause1&lt;SPAN class="punctuation token"&gt;)&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When formatted so it is easier to read.&lt;/P&gt;&lt;P&gt;So line 1... is the input shapefile, however, the path to the shapefile is not specified, so there has to be a reference to an environment variable (ie ... &amp;nbsp; arcpy.env.workspace = r"c:\folder\subfolder")&lt;/P&gt;&lt;P&gt;line 2 and 4 ... contain triple double quotes to encase/enclose the code block shown (separated on its own line to facilitate reading).&amp;nbsp; The actual code block uses the format for shapefiles, etc,&amp;nbsp; Field names are enclosed in double quotes and text conditions on the right of the condition check are enclosed in single quotes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:44:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358115#M28293</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T16:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple attributes from the same column using where_clause</title>
      <link>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358116#M28294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For simplicity reasons it would be better to use&amp;nbsp;the IN operator:&lt;/P&gt;&lt;P&gt;"DrainClass" IN ('Well drained', 'Somewhat excessively drained')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Apr 2017 04:27:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-multiple-attributes-from-the-same-column/m-p/358116#M28294</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2017-04-23T04:27:30Z</dc:date>
    </item>
  </channel>
</rss>

