It has been a while since I've used ModelBuilder or Python.
- I have a point feature class
- I want to be able to use a drop down list to select one of those points
- Drop down will be based on a Name field in the point feature
- That point will then be fed into the rest of my model
Is there a way to do this with ModelBuilder/tools, or just as a simple python script insert into ModelBuilder?
2 Answers 2
You can do this with the parameter validation in a script tool.
As a workaround if you don't want to use arcpy, you can add an SQL expression variable to your model, connect it to a tool using it (Select, Make Feature Layer, ...) and make it a model parameter. The user will have to build the expression (double-click the field name, add equal sign, double-click the desired field value) himself. You can get a list of the unique values in a given field by clicking 'Get Unique Values' (you must select a field first):
-
Thanks for the workaround, but I'm trying to design for user simplicity. I don't want people building expressions with this haha. I will check out parameter validation, thanks!KeenanS– KeenanS2016年08月18日 13:32:05 +00:00Commented Aug 18, 2016 at 13:32
-
Sure it's neater but requires a bit more effort. Good luck!GISGe– GISGe2016年08月18日 13:32:53 +00:00Commented Aug 18, 2016 at 13:32
I would like to share my method too. It depends on how many names you have in your layer. If not so much, then this is for you.
First, make a model like this
The empty figure called name is a variable string parameter. The expression of tool Select Layer by attribute make a selection based on what word will be in Name parameter. After you made a model save it and open its properties. Here you have to check Model Parameters tab:
There you will see your string parameter. Now click on the box under the word Filter (there should be "None") and select Value list. Then click a button from right and here you have fot a table in which you should type all the names you have in your field. After you finish it, click Apply and try to start the model. The drop-down list should appear.