Model Builder tool question

1170
4
Jump to solution
09-24-2021 08:59 AM
JustinBernard1886
New Contributor III

Hi, 

So I created a model that requires the use of 3 seperate "select by attribute." tools. For the model to run, the user must input a value into each tool seperately. I was wondering if it's possible to make it so that the user can enter the value once, and all 3 tools are automatically updated? Is it possible this can be done using Python and what would the code look like?

Thanks

Justin

0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor

Are Expression and Expression(2) different? If they are the same, you can connect the same variable to both Select Layer by Attribute tools.

Whether they are the same or different, make them parameters and run the model as a tool.

View solution in original post

4 Replies
curtvprice
MVP Esteemed Contributor

If you can build the three expressions from one input, that can be done using the Calculate Value tool. Or you can have the three expression marked as parameters and the user can specify them and run the model.  

Another approach is to create a variable and then use that variable directly in the SQL expressions for you select by attribute  surrounded by % signs. The value is substituted in at runtime.

I think we need a little more detail to understand what you need, but maybe this will help you get started.

0 Kudos
JustinBernard1886
New Contributor III

Apologies for the late response, I had to put this project on the backburner for a while. 
Attached is a screenshot of my model. As you can see, I have two select by attribute tools in this model. For it to run, the user will have to select from 79 Areas(Called Z-Areas in my organization) in both select by attribute tools. I would to make it so that the user will only have to make one input instead of having to open each Select Layer tool and make the selection. Is this possible? 

Thanks

JustinBernard1886_0-1633521730943.png

 

0 Kudos
curtvprice
MVP Esteemed Contributor

Are Expression and Expression(2) different? If they are the same, you can connect the same variable to both Select Layer by Attribute tools.

Whether they are the same or different, make them parameters and run the model as a tool.

JustinBernard1886
New Contributor III

Oh perfect! Setting the parameters and running the model as a geoprocessing tool worked perfect. 
Thanks so much for that solution!

0 Kudos