armein01

Problems with "adding to selection" and "switch selection" using python.

Discussion created by armein01 on Feb 2, 2014
Latest reply on Feb 6, 2014 by armein01
I want to select data for processing from a wetland dataset. 76,000 records.
When I run step by step in python window I can create a new selection, then add to the selection and finally,
switch selection, but I cant get the same code to run as a block in the window.   The resulting layer has all the features selected.
I have tried to code all the selection in one line and switch in the next but that didnt work either.  Ive closed arc thinking some residual caused the issue and no luck.
I would like to have standalone script in the end. 
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")

Im wondering if I should take another approach or if I am missing something?  Maybe I would be better off selecting from a table.
My data is in a file geodatabase.

Thanks!
Alicia

Outcomes