<?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: Problems with &amp;quot;adding to selection&amp;quot; and &amp;quot;switch selection&amp;quot; using python. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365967#M28900</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you post an example of the table your are selecting from?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Feb 2014 13:16:47 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2014-02-05T13:16:47Z</dc:date>
    <item>
      <title>Problems with &amp;quot;adding to selection&amp;quot; and &amp;quot;switch selection&amp;quot; using python.</title>
      <link>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365964#M28897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want to select data for processing from a wetland dataset. 76,000 records.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run step by step in python window I can create a new selection, then add to the selection and finally,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;switch selection, but I cant get the same code to run as a block in the window.&amp;nbsp;&amp;nbsp; The resulting layer has all the features selected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried to code all the selection in one line and switch in the next but that didnt work either.&amp;nbsp; Ive closed arc thinking some residual caused the issue and no luck.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to have standalone script in the end.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
arcpy.MakeFeatureLayer_management(wtlndPath, "wtlnd4Analysis")
arcpy.SelectLayerByAttribute_management("wtlnd4Analysis", "NEW_SELECTION", ' "WETLAND_TYPE" = \'RIVERINE\' AND "ATTRIBUTE" LIKE \'%H%\' ')
arcpy.SelectLayerByAttribute_management("wtlnd4Analysis", "ADD_TO_SELECTION", ' "WETLAND_TYPE" = \'LAKE\' AND "ATTRIBUTE" LIKE \'%UBH%\' ')
arcpy.SelectLayerByAttribute_management("wtlnd4Analysis", "SWITCH_SELECTION")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Im wondering if I should take another approach or if I am missing something?&amp;nbsp; Maybe I would be better off selecting from a table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My data is in a file geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alicia&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 06:04:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365964#M28897</guid>
      <dc:creator>AliciaMein</dc:creator>
      <dc:date>2014-02-03T06:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with "adding to selection" and "switch selection" using python.</title>
      <link>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365965#M28898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What happened when you tried to make your selection code in one query and then switch selection?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 14:16:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365965#M28898</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-02-03T14:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with "adding to selection" and "switch selection" using python.</title>
      <link>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365966#M28899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When I had the entire selection in one line of code&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.SelectLayerByAttribute_management("wtlnd4Analysis", "NEW_SELECTION", ' "WETLAND_TYPE" = \'RIVERINE\' AND "ATTRIBUTE" LIKE \'%H%\' OR "WETLAND_TYPE" = \'LAKE\' AND "ATTRIBUTE" LIKE \'%UBH%\' ')
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I loaded this into the python window and I never saw the selection change.&amp;nbsp; It would be obvious, because there are several very large river that would be removed.&amp;nbsp; I tried adding () around where clause and still nothing changed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Today I run this on on my desktop at work instead of my laptop and it doesnt even work as I step through.&amp;nbsp; I get an empty selection no mater what? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Im stumped.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alicia&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Back working on laptop, and this works thus far:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.MakeFeatureLayer_management(wtlndPath, "wtlnd4Anlys_lyr")
arcpy.SelectLayerByAttribute_management("wtlnd4Anlys_lyr", "NEW_SELECTION", ' "ATTRIBUTE" LIKE \'R%H%\' OR "ATTRIBUTE" LIKE \'L%UBH%\' ')
arcpy.SelectLayerByAttribute_management("wtlnd4Anlys_lyr", "SWITCH_SELECTION")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:00:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365966#M28899</guid>
      <dc:creator>AliciaMein</dc:creator>
      <dc:date>2021-12-11T17:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with "adding to selection" and "switch selection" using python.</title>
      <link>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365967#M28900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you post an example of the table your are selecting from?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 13:16:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365967#M28900</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-02-05T13:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with "adding to selection" and "switch selection" using python.</title>
      <link>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365968#M28901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Can you post an example of the table your are selecting from?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This a standard attribute from the NWI table which is in a geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]31190[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; The Pic is small so I attached a better image also.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did get the last, most recent, code to run on my desktop and laptop.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 18:54:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problems-with-amp-quot-adding-to-selection-amp/m-p/365968#M28901</guid>
      <dc:creator>AliciaMein</dc:creator>
      <dc:date>2014-02-06T18:54:22Z</dc:date>
    </item>
  </channel>
</rss>

