<?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 layer by attributes empty and null in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322021#M25079</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are over thinking it a bit, there is no reason in introduce a search cursor.&amp;nbsp; The following will get the same results but is more straightforward and quicker:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;mem_fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Taxparcels&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"in_memory\TaxPar"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
fl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mem_fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TaxPar"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"DXF_TEXT LIKE 'Q%' or DXF_TEXT = ' ' or DXF_TEXT IS NULL"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fl&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; query&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fl&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;DeleteFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fl&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:17:33 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2021-12-11T15:17:33Z</dc:date>
    <item>
      <title>Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322011#M25069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following, i am trying to select and delete all the empty and null attributes but when i run the code the output feature class is empty. I am not sure what i am doing wrong, the SelectLayerByAttribute_management works in Arcmap python window.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;# Process: Make Feature Layer
TAX1 = "in_memory\TaxPar"
arcpy.MakeFeatureLayer_management(Taxparcels, TAX1)

#Delets&amp;nbsp; Parcels that are blank, NULL or start with Q

query = "DXF_TEXT LIKE 'Q%' or DXF_TEXT = ' ' or DXF_TEXT IS NULL"
arcpy.SelectLayerByAttribute_management(TAX1, "NEW_SELECTION", query)
if int(arcpy.GetCount_management(TAX1).getOutput(0)) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(TAX1)

arcpy.FeatureClassToFeatureClass_conversion(TAX1, "D:/GIS Folder/Blah/blah.gdb", "Blah2")&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 15:17:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322011#M25069</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-11T15:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322012#M25070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are trying to create a feature layer whose name is "in_memory\TaxPar".&amp;nbsp; I strongly suggest not doing this.&amp;nbsp; What if you change the layer name to something like "TAX1"?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2018 23:04:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322012#M25070</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-11-27T23:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322013#M25071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure what you mean by change the layer name to "TAX1", i was trying to create a feature layer In_memory to work with which is why i have line 3.&lt;/P&gt;&lt;P&gt;I was thinking my query syntx was wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2018 23:18:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322013#M25071</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2018-11-27T23:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322014#M25072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All feature layers are created in memory, you don't have to put "in_memory" in the name.&amp;nbsp; If anything, putting "in_memory" in the name will confuse geoprocessing functions about the type of object you are passing to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would start by changing line 2 to:&lt;/P&gt;&lt;PRE class=""&gt;&lt;CODE&gt;TAX1 = "TaxPar"&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2018 23:27:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322014#M25072</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-11-27T23:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322015#M25073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or just leave out line 2 and the assignment of TAX1 all together&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# &lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Taxparcels&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'taxparclesLYR'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Delets&amp;nbsp; Parcels that are blank, NULL or start with Q&lt;/SPAN&gt;

query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"DXF_TEXT LIKE 'Q%' or DXF_TEXT = ' ' or DXF_TEXT IS NULL"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'taxparclesLYR'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; query&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:17:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322015#M25073</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T15:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322016#M25074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, i see, thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2018 15:30:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322016#M25074</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2018-11-28T15:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322017#M25075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, so after pulling my hair out with this issue. I noticed that it removed the blanks and nulls from the original dataset not the dataset in MakeFeautreLayer_management. Why is it working off the original dataset? Should i be checking to see if there are attributes with 'Q', ' ' &amp;amp; NULL first? If so how do check with arcpy.SelectLayerByAttribute_management?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2018 15:47:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322017#M25075</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2018-11-28T15:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322018#M25076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Feature Layers and Table Views don't contain any actual data, they simply reference data.&amp;nbsp; If you create a feature layer and use it in geoprocessing tasks, the underlying data is being modified.&amp;nbsp; If you need to leave the original data set intact, I recommend copying the data set either into memory or a scratch GDB and then making the feature layer on it, clean it up, and then do whatever you need to next.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2018 15:54:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322018#M25076</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-11-28T15:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322019#M25077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was typing this as Joshua's latest response came in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to work on a feature class with arcpy, you need to work 'through' a feature layer.&amp;nbsp; When you open up arcmap and&amp;nbsp;make edits, ArcMap is doing the behind the scenes work for you with respect to a feature layer.&amp;nbsp; If you run an arcpy script in arcmap, you need to have arcpy do that behind the scenes work.&amp;nbsp; Consider this: if you run an arcpy script as a scheduled task and that script interacts with a feature class, having that middle man of a feature layer is the only thing you can do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are trying to weed out null values and/or blank values, I think it is good practice to take a close look at your data first with ArcMap queries to get a handle on what you are facing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2018 16:00:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322019#M25077</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2018-11-28T16:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322020#M25078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I took your guys recommendations and came up with the following, not sure if this correct or the best way but it seem to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy.CopyFeatures_management(Taxparcels, "in_memory\TaxPar")
arcpy.MakeFeatureLayer_management("in_memory\TaxPar", "TaxPar")

query = "DXF_TEXT LIKE 'Q%' or DXF_TEXT = ' ' or DXF_TEXT IS NULL"

with arcpy.da.SearchCursor("TaxPar", "DXF_TEXT") as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[0] in (""," ",None,"Q%"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management("TaxPar", "NEW_SELECTION", query)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if int(arcpy.GetCount_management("TaxPar").getOutput(0)) &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management("TaxPar")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:17:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322020#M25078</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-11T15:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select layer by attributes empty and null</title>
      <link>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322021#M25079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are over thinking it a bit, there is no reason in introduce a search cursor.&amp;nbsp; The following will get the same results but is more straightforward and quicker:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;mem_fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Taxparcels&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"in_memory\TaxPar"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
fl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mem_fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TaxPar"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"DXF_TEXT LIKE 'Q%' or DXF_TEXT = ' ' or DXF_TEXT IS NULL"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fl&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; query&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fl&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;DeleteFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fl&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:17:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-layer-by-attributes-empty-and-null/m-p/322021#M25079</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T15:17:33Z</dc:date>
    </item>
  </channel>
</rss>

