AnsweredAssumed Answered

Using a list for selection

Question asked by cfoster15 on Apr 18, 2012
Latest reply on Apr 18, 2012 by cfoster15
I am using Arc10 SP4.

I have a script completed for Parcel Noticing, it asks the user to input one parcel number and then runs through the script.  We sometimes have to select multiple parcels for noticing.

How would I go about starting a script using an excel file or text file that contains a list of parcel numbers?  I want to create a script that allows the user the ability to select a file that contains a list of parcel numbers, have the script create a list that can be used in python to do a multiple selection.

layer = arcpy.GetParameterAsText(0) apnlist = arcpy.GetParameterAsText(1) mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames (mxd, "LAYERS")[0]


What data type parameter property should i use? ie, string or file

Once this is determined, how do I go about turning that input into a list that I can use to create a selection?

I am assuming it is going to be a for loop like this:

for apn in apnlist:     selstring = """TAG = '{0}'""".format(apn)     arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", selstring)

Outcomes