g_m_baker

flexible query filter

Discussion created by g_m_baker on Nov 14, 2012
I am looking to develop a query filter tool that can be used inside of a application that is using the JavaScript API. I want the control to look and function somewhat similar to the vertical left hand filter on Cars.com:

http://www.cars.com/for-sale/searchresults.action?sf1Dir=DESC&PMmt=0-0-0&sf2Dir=ASC&sf1Nm=price&sf2Nm=miles&rpp=50&feedSegId=28705&searchSource=GN_BREADCRUMB&crSrtFlds=feedSegId&pgId=2102

Imagine that I have a database of cars for sale and each car has a lat/long associated with it. I can easily display the cars as a point layer in a web based application using the JavaScript API. I would like to be able to apply a definition query to the layer so that I can filter on things like make, model, color, transmission using this control. So for example I would like to be able to see where all of the Red Ford Mustangs are with manual transmissions. When I make the selections I would like the point layer to automatically update to reflect my choices.

Another requirement is that the filter dynamically update to only allow the user to make valid selections based on the selections that have already been made. So for example: if I pick Ford as the make I should not see Civic as an option under the model filter.

Does anyone have an existing control or examples of anything like this?  One of the major challenges I am having is figuring out how to build the query to update all of the filters and the map each time a selection is made.

Outcomes