I am trying to code a Python add in for ArcGIS 10.2. I have a shape called FACILITIES which contains facilities, a field CATEGORY and I wish to select all the entities that are categorized as "school"In order to populate a ComboBox into that addin, I use the SelectLayerByAttribute tool, as follows :
arcpy.SelectLayerByAttribute_management("FACILITIES", "NEW_SELECTION","CATEGORY = '" + "school" + "'")It is working properly. But I wish the category to be variable. So I tried like this :
SelectedCategory = "school"arcpy.SelectLayerByAttribute_management("FACILITIES", "NEW_SELECTION","CATEGORY = '" + SelectedCategory + "'")But even though it seems very similar my Combobox fails to launch.What am I doing wrong ?
Thank you very much for your help !
أكثر...
arcpy.SelectLayerByAttribute_management("FACILITIES", "NEW_SELECTION","CATEGORY = '" + "school" + "'")It is working properly. But I wish the category to be variable. So I tried like this :
SelectedCategory = "school"arcpy.SelectLayerByAttribute_management("FACILITIES", "NEW_SELECTION","CATEGORY = '" + SelectedCategory + "'")But even though it seems very similar my Combobox fails to launch.What am I doing wrong ?
Thank you very much for your help !
أكثر...