<?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: Select by Attributes and append in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392901#M31106</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am surprised you aren't getting an error because your SQL syntax is not valid, i.e., text expressions with wildcards are not supported with the IN operator.&amp;nbsp; Given your level of SQL knowledge, the best approach is chaining together some LIKE statements:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;where_clause &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Status LIKE 'Active%' OR Status LIKE 'Existing%'"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CCAP&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CCAP1_lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; where_clause&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;CODE&gt;&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 18:00:31 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2021-12-11T18:00:31Z</dc:date>
    <item>
      <title>Select by Attributes and append</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392898#M31103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to update a feature class with points that have "Active" in the "Status" field.&lt;/P&gt;&lt;P&gt;I have tried "Status LIKE 'Active%'" &amp;amp;&amp;nbsp; "\"Status\" LIKE 'Active%'" for the query but no matter what it appends all of the points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fc2 = "sde\\blah\\UpdatePoints"
arcpy.DeleteFeatures_management(fc2)

#Output = "UpdatePoints1"
CCAP = "sde\\points\\Points1"

arcpy.MakeFeatureLayer_management(CCAP, "CCAP1_lyr")
arcpy.SelectLayerByAttribute_management("CCAP1_lyr", "NEW_SELECTION", "Status LIKE 'Active%'") #"\"Status\" LIKE 'Active%'"

arcpy.Append_management("CCAP1_lyr", "sde\\blah\\UpdatePoints", "NO_TEST")

‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/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;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:00:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392898#M31103</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2021-12-11T18:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select by Attributes and append</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392899#M31104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could remove the selection all together and apply the query when creating the Feature Layer.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fc2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"sde\\blah\\UpdatePoints"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;DeleteFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Output = "UpdatePoints1"&lt;/SPAN&gt;
CCAP &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"sde\\points\\Points1"&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CCAP&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CCAP1_lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Status LIKE 'Active%'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Append_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CCAP1_lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"sde\\blah\\UpdatePoints"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NO_TEST"&lt;/SPAN&gt;&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;/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;&lt;/P&gt;&lt;P&gt;Also, you make want to execute the Make Feature Layer in ArcGIS Pro to make sure the query is correct.&amp;nbsp; You can then &lt;A href="https://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/basics/geoprocessing-history.htm#ESRI_SECTION1_DE181D2B95F04F62B3FDEE74391F89BC" rel="nofollow noopener noreferrer" target="_blank"&gt;copy the python command&lt;/A&gt; from the History tab.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:00:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392899#M31104</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T18:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Select by Attributes and append</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392900#M31105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wanted to do select multiple values and tried the following but it seems like it just selects "Active" ones.&lt;/P&gt;&lt;P&gt;I need to select "Active" &amp;amp; "Existing",&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fc2 = "sde\\blah\\UpdatePoints"
arcpy.DeleteFeatures_management(fc2)

#Output = "UpdatePoints1"
CCAP = "sde\\points\\Points1"

where_clause = "Status IN ('Active%','Existing%')"
arcpy.MakeFeatureLayer_management(CCAP, "CCAP1_lyr", where_clause)

arcpy.Append_management("CCAP1_lyr", "sde\\blah\\UpdatePoints", "NO_TEST")&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;/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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:00:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392900#M31105</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2021-12-11T18:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Select by Attributes and append</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392901#M31106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am surprised you aren't getting an error because your SQL syntax is not valid, i.e., text expressions with wildcards are not supported with the IN operator.&amp;nbsp; Given your level of SQL knowledge, the best approach is chaining together some LIKE statements:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;where_clause &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Status LIKE 'Active%' OR Status LIKE 'Existing%'"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CCAP&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CCAP1_lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; where_clause&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;CODE&gt;&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:00:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392901#M31106</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T18:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select by Attributes and append</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392902#M31107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that worked thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 15:09:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attributes-and-append/m-p/392902#M31107</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2020-04-28T15:09:29Z</dc:date>
    </item>
  </channel>
</rss>

