bryandieter1

Model Builder - Make Query Table expression

Discussion created by bryandieter1 on Jun 16, 2014
I am working on a model that uses the 'Make Query Table' Tool as the first step in the workflow.   There are 3 fields from the input table being used in the query expression, which I have set up as model parameters so that users can define the query.

I have created in the model three string variables, called SelectVar1, SelectVar2 and SelectVar3.  These are model parameters and are connected to the Make Query Table as 'preconditions'. 

Within the Make Query Table tool dialog, the Expression is defined as follows:

"Var1" = %SelectVar1% AND "Var2" = %SelectVar2% AND "Var3" = %SelectVar3%

This is working fine; whatever values are provided for the parameters are plugged in to the query.  However, there are limitations with this approach.  Specificly, only 1 value is allowed per variable, and all 3 variables are required for the query to work. 

What if I want the query to be a bit more flexible with the query inputs?  For example, query multiple values from a single variable, or query based on one variable but not the others?  Ideally, I would like users running the model to be presented with a list of possible values for each variable, and let them click check boxes to choose which values to query for. 

Does anybody have any thoughts on how this might be accomplished?  Thanks

Outcomes