# Model selects parcel from user input import arcpy # Assign variable to the feature class featureClass = "G:\\PRAD\\PRAD_v10.1.gdb\\tax_acct" # Assign variable to users input input = arcpy.GetParameterAsText(0) # Make a feature layer from feature class arcpy.MakeFeatureLayer_management(featureClass, "layer") # Apply a selection to the feature layer arcpy.SelectLayerByAttribute_management("layer", "NEW_SELECTION", '"'+str(input)+'"')
Solved! Go to Solution.
Ok. I will see what I can do with that. Thanks for all your help!
I made a slight addition to the loop to add the if/else to get the proper and statements added.
Is there a way of doing something similar and searching three fields with one input box?
[ATTACH=CONFIG]17604[/ATTACH]
I would like to be able to get same selection of first row by using either job_num or job_num2 using single input box.
query = "{1} = '{0}' or {2} = '{0}' or {3} = '{0}'".format(job_num, "Job_Num", "Job_Num2", "Job_Num3")
I'm not sure what you are doing since you will never be able to select one row with any query unless you reference a unique ID, which it seems neither job_num nor job_num2 are. If there are values that are the same between the two columns but do not match the same row this would be even more challenging to implement in a single parameter.
If there are no numbers that match between the columns and you just want a number inputted to return any result from those three columns that match, try this as your query.query = "{1} = '{0}' or {2} = '{0}' or {3} = '{0}'".format(job_num, "Job_Num", "Job_Num2", "Job_Num3")