Select Tool expression in Model Builder

4910
6
07-02-2013 03:55 AM
ABSARASGHAR
New Contributor
Hello Everyone,

Can anyone please guide me that how to use Multi-Value string variable for the SELECT tool in the model builder? I want to select multiple values from a field by using model builder.
0 Kudos
6 Replies
ShitijMehta
Esri Regular Contributor
May be this will help:
For details on the expression syntax see Building an SQL Expression or SQL Reference.
0 Kudos
ABSARASGHAR
New Contributor
Thank you,

And how to use that in model builder as (multivalue string) inline variable in order to select multiple values from the same field?
0 Kudos
ShitijMehta
Esri Regular Contributor
Use selection tools like Select, Select Layer by attribute, Table Select, Make Feature Layer. Build a query if

field1= 3 or field1=4 or field1=5

or

field1= 3 and field1=4 and field1=5


Am I missing something in your question? Let me know with a screenshot of your table if that is the case.
0 Kudos
ABSARASGHAR
New Contributor
Use selection tools like Select, Select Layer by attribute, Table Select, Make Feature Layer. Build a query if

field1= 3 or field1=4 or field1=5

or

field1= 3 and field1=4 and field1=5


Am I missing something in your question? Let me know with a screenshot of your table if that is the case.




Here is the screenshot what I want to do. I have given list of values in model parameter named as Type. Now I want to select by  attribute and want to merge all the selected ones into one file inside the model builder for further analysis. But It this model runs till collect Values but after that don't merge because output of the collect value tool is with the same name after every iteration.
I hope you understand.
0 Kudos
ShitijMehta
Esri Regular Contributor
Hi,
From the screenshot this is what I understand:

You have say two values in your variable called type: Value 1 and Value 2 which the user provides as it is a model parameter.
This is how the iterator works: It takes the first value: value 1 and sends that value to the Select tool. This tool creates a new output based on your selection and sends it to the Collect Values. The iterator now runs for the second time for Value 2 and creates a new output.

This is where I am guessing is the problem. Your output file  in the Select tool does not have a unique name for each iteration so it overwrites the  same file over and over again. If you need a unique name for each iteration you have to use in-line variable substitution %Type% something like this: C:\Temp\%Type%. This will ensure all the new outputs have a unique value. After this you want to merge - Please check Advanced use of model iterators

You can also use %n% in the output name  like this: C:\Temp\Output_%n%. This will create new outputs with names like this: Output_0, Output_1 and so on

If you choose to use %Type% and the type values have spaces or any special characters in them you will need to use the Calculate Value Tool to remove the spaces before using the value as inline variable. Check Calculate value help.
0 Kudos
ABSARASGHAR
New Contributor
Thanks a lot I have gotten an idea.
0 Kudos