AnsweredAssumed Answered

Select layer by attributes empty and null

Question asked by CCweedcontrol on Nov 27, 2018
Latest reply on Nov 28, 2018 by bixb0012

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.

 

# Process: Make Feature Layer
TAX1 = "in_memory\TaxPar"
arcpy.MakeFeatureLayer_management(Taxparcels, TAX1)

#Delets  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)) > 0:
    arcpy.DeleteFeatures_management(TAX1)

arcpy.FeatureClassToFeatureClass_conversion(TAX1, "D:/GIS Folder/Blah/blah.gdb", "Blah2")

Outcomes