I have the following basic code, I need to be able to run the script to select either 1 features or multiple features based on what is provided from arcpy.GetParameterAsText(0)
I have the arcpy.GetParameterAsText(0) set as 'Any Value' and for the data type parameter properties MultiValue set to 'Yes' but I keep getting the error. I am guessing that my whereClause is incorrect and if so how can I get to work?
PLATNAME field is a text field.
Error;
ERROR 000358: Invalid expression
Failed to execute (SelectLayerByAttribute)
Script code;
import arcpy
mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd, "Layers") [0]
lyr = arcpy.mapping.ListLayers(mxd, "Subs")[0]
search_string = arcpy.GetParameterAsText(0)
search_string = search_string.split(";")
search_string = ["'{0}'".format(v) for v in search_string]
whereClause = "{0} IN ({1})".format("PLATNAME", ",".join(search_string))
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION",whereClause )
with arcpy.da.SearchCursor(lyr, ["SHAPE@","PLATNAME"]) as cursor:
for row in cursor:
df.extent = row[0].extent
df.scale = df.scale * 5
arcpy.RefreshActiveView()