7

How do I clear any selected features using ArcPy, which may cause an error if I run my tool and the user has made a selection on that layer or table view.

I need something that runs ("CLEAR_SELECTION") before I use something like:

rows = arcpy.SearchCursor(Table, " \"Name\" LIKE 'Albert%' ", "", "Name;")
0

1 Answer 1

20

Here is the help document covering the function in question: Select Layer by Attribute (Data Management)

I think this is how you would implement it:

arcpy.SelectLayerByAttribute_management(Table, "CLEAR_SELECTION")
rows = arcpy.SearchCursor(Table, " \"Name\" LIKE 'Albert%' ", "", "Name;")

As an aside, there are a lot of helpful examples of how to use the various toolbox tools, and their python implementations on the ArcGIS Desktop Help Site in the Professional Library. A quick search there will often yield an answer faster than on GIS SE.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.