1

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

1

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):

enter image description here

2
  • 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
    Aug 18, 2016 at 13:32
  • Sure it's neater but requires a bit more effort. Good luck!
    – GISGe
    Aug 18, 2016 at 13:32
1

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

enter image description here

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:

enter image description here

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.