Attribute Query using Model Builder

1342
2
09-06-2016 10:38 AM
akshayloya
Occasional Contributor II

Hi Everyone,

I want to create model in arcmap using model builder for select by attribute.

1) I want to create a dropdown list for columns fields of the selected feature class

2) Write a dynamic sql expression as in:

   a) User will select column name from the drop down.

   b) User enters a value in a value box

  c) At a back end, SQL query is made based on above selection.

Example: Select Features from School feature class having objectid >= 6 AND objectid <=  15.

This is simply to make attribute query easy to use for the user. Any help will be greatly appreciated.

Thanks in Advance!

 

0 Kudos
2 Replies
DarrenWiens2
MVP Honored Contributor

Your example (objectid >= 6 AND objectid <=  15) illustrates the problem with using rigid dropdown lists to build SQL queries. It includes (or could include) multiple fields, operators, and a condition. You could make dropdowns for all of those, but how is that any better than the out-of-the-box query builder within the Select Layer By Attribute tool?

0 Kudos
akshayloya
Occasional Contributor II

There will be only one condition mentioned above (between) and the same operators will be used. So I don't want user to select all those options. He will simply select field from a dropdown and in to boxes he will enter the value.

Please refer to pic below.