Select to view content in your preferred language

Model Builder with variable Parameter

86
2
Jump to solution
yesterday
Labels (3)
XanderJohnson
Emerging Contributor

I'm trying to configure a model that will iterate over the tables in a geodatabase, so that it will output a selection that matches the input string provided by the user. The problem that I'm running in to is that, while I would like to query a consistent column across the tables, these columns do not all have the same name. They are named after the same convention response_X, where substituting the string after the underscore (see screenshot) indicates which table is being referenced. I haven't been able to code this into the SQL search, and am at a little bit of a loss.

I've tried changing the column names to just plain response, while leaving the distinctions only as aliases. When I do this, the model will run, but I don't end up with anything selected from the tables. So clearly there's something I'm missing in the model flow itself. 

 

This is designed to be a pilot before expansion to a larger dataset that would be stored in a similar format, although the naming conventions would differ, and it is helpful to be able to distinguish the source of a given "response" entry without having to rely on aliases for the purposes of data organization and clarity. 

 

Essentially, I want users to be able to input an SQL query as the parameter, have the model iterate over the response columns in the database, and return all hits as a selection. These tables are related to a point feature layer with the appropriate settings, so selections from this model should then be selected on the map. Is this even feasible within Model Builder? I exported the script for the model to python but even within ArcGIS Pro it won't run in the terminal, as it seems to be missing some dependencies and doesn't like the model's references to <string>.

 

I'm running ArcGIS Pro 3.7. Many thanks for any thoughts and input!

 

EDIT: I figured that the copy table step in the middle may have been part of the issue. The model still outputs the same results even with that copy rows removed.

XanderJohnson_0-1785169111633.png

XanderJohnson_1-1785170827936.png

 

 

0 Kudos
1 Solution

Accepted Solutions
BobBooth1
Esri Regular Contributor

It might be simpler to add a table (locality) name field to each of your tables, calculate that value so each record has the locality name on it, and then append all those in one table. Your selection process would then be a lot simpler, and you'd still know the original source table.

View solution in original post

2 Replies
BobBooth1
Esri Regular Contributor

It might be simpler to add a table (locality) name field to each of your tables, calculate that value so each record has the locality name on it, and then append all those in one table. Your selection process would then be a lot simpler, and you'd still know the original source table.

XanderJohnson
Emerging Contributor

That does solve the selection issue and makes things easier to work with. Thanks!

0 Kudos