I am creating an ArcPy scripting tool to allow users to select a feature from a feature layer and then zoom to that selection. I have successfully created this tool and now am working on creating the parameters.
I want the user to be able to view a dropdown list of the allowable selections (taken from a field within the attribute table of the feature layer). I currently have the parameter set as a sql expression- however this would require the user to type in more information than they probably know. How can I create a populated dropdown list for the parameter that will correctly input the sql expression? I have attached my code below.
import arcpy Selection = arcpy.GetParameterAsText(0) mxd = arcpy.mapping.MapDocument("CURRENT") dataFrame = arcpy.mapping.ListDataFrames(mxd, "*") arcpy.SelectLayerByAttribute_management("PLSS.lyr","NEW_SELECTION", Selection) dataFrame.zoomToSelectedFeatures()