Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I would like to Clear Any Selected Features using python since it causes an error if I run my tool and the user has a recorded selected.

I need some thing here that runs ("CLEAR_SELECTION") first

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

Thoughts?

share|improve this question
1  
I reverted your edit - it doesn't make sense to edit the question to show the answer. The correct approach is to leave your question as originally asked, and have the answer shown below. –  Stephen Lead Dec 19 at 2:56
    
I think I had done it this way since it does not let you answer your own question right away. Anyways will note for future posts –  TForward Dec 19 at 21:53

1 Answer 1

up vote 4 down vote accepted

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. Oftentimes a quick search there will yield an answer faster than on GIS.se

Hope this helps!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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