I'm having trouble with the button class of my code:
class OKButton(object): """Implementation for ok.button (Button)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): mxd = arcpy.mapping.MapDocument("CURRENT") df = mxd.activeDataFrame arcpy.SelectLayerByAttribute_management(layer,"NEW_SELECTION",valueS) df.zoomToSelectedFeatures() arcpy.RefreshActiveView()
The toolbar allows the user to select a data frame, a layer within it, a field within that layer, and a value within that field. In the above code, "layer" and "valueS" are the global variables referring to the chosen layer and value within one of its fields, respectively. However, when I run the code this error is raised:
ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute).
I know I need to replace the where_clause with an SQL expression based on the value the user selects (currently the global variable "value"). How could I go about this?