[GIS] Query Layer with user-defined (dynamic) parameters in ArcGIS 10.1

arcgis-10.1arcgis-javascript-apiarcgis-serverarcmapquery-layer

I have prepared and published with ArcMap 10.1 to my ArcGIS Server a Query Layer to access
some information in my database. My output map represents the European
Union states and using annotations, the number of cities and villages each country has.

Now, I would like to go a step further and try to specify some parameters
in the WHERE clause of the SQL query that defines my query layer. Therefore
the user in my web application can select from a drop-down list box simple parameters
like filtering just by "Cities" or "Villages" or by population number.

I just would like to know if it is possible to configure ArcGIS to expect
some input parameters
coming from the web and execute the SQL query with these parameters once
they have been received. Is there a way of injecting those parameters back
to the ArcGIS Server and make it calculate the data I need?

Please, could you provide any ideas or guidelines about how this would be done?

Best Answer

Absolutely! ArcGIS Server was made for these sorts of tasks. Check out the Query task in the JavaScript API here:

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/query_gpresult.html