AnsweredAssumed Answered

Multivalue query

Question asked by Tonyalmeida on Mar 26, 2013
Latest reply on Mar 27, 2013 by Tonyalmeida
I am trying to create a script that allow me to enter more then one value to search, select and create a new feature from the selected. My script runs and finished fine but produces no out feature class. I am not sure if i am doing it correctly or not but any help would be great.


import arcpy  arcpy.env.overwriteOutput = True mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] lyr = arcpy.mapping.ListLayers(mxd, "Taxparcels")[0]  #Define input/output input = arcpy.GetParameterAsText(0) fieldName = arcpy.GetParameterAsText(1) values = arcpy.GetParameterAsText(2) output = arcpy.GetParameterAsText(3)  #Build the where clause queryJoin = "' OR " + fieldName + " = '" whereClause = fieldName + " = '" + queryJoin.join(values) + "'"  #Select(input, output, whereClause) arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause) if int(arcpy.GetCount_management("Taxparcels").getOutput(0)) > 0:     arcpy.Select_analysis("Taxparcels", output) 

Script parameters
are attached.