Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm hoping to find some existing code which emulates the "Select by Attributes" dialog in ArcMap, within the ArcGIS Server JavaScript API.

Writing a hard-coded QueryTask is easy - I'm looking for some code which will automatically handle any layer on the map, forming a Query on-the-fly using any attributes, ideally returning the results into a datagrid.

Clever people have written Table of Contents and Identify widgets which handle any layers in the map. Has anyone written something similar for "select by attributes"?


share|improve this question
Did you ever find a solution to this? – user5070 Dec 7 '11 at 17:17
Nothing yet, sorry – Stephen Lead Jun 4 '12 at 14:34
Do you try the find task ?… – user3120 Nov 7 '12 at 20:27
I wasn't aware that there is some specific plugin architecture for the Javascript API. Were you looking for a dojo widget which works and looks like the Select By Attribute window in ArcMap? – Devdatta Tengshe Jan 2 '13 at 10:39
@DevdattaTengshe I was hoping for something similar to this TOC sample which is easy to integrate – Stephen Lead Jan 6 '13 at 23:43

3 Answers 3

If you are using ArcServer 10.1 you could create a Geoprocessing service which references either a model or script that you built to do this.

The link above gives step by step instructions on how to create the model, then create the services and finally consume it in your app.

Alternatively, there is this sample that uses a query to select records, you could modify that to allow for multiple services.

share|improve this answer

A couple of years later, I was looking for exactly the same thing as the OP. This question shows up in the top results of a search engine, so I decided to leave this update here as a reference.

In the Summer of 2015, Esri has released a Select by Attributes Widget in their GitHub repository.

This widget attempts to recreate ArcMap's select by attributes tool as accurately as possible within a JavaScript application. This widget only works with feature layers and these must be passed to the widget's constructor as an array.

Live Sample

share|improve this answer
up vote 0 down vote accepted

It's clear that there is an appetite for a plugin like this.

As everyone has noted, there's nothing particularly difficult about running a single, simple query. Where it gets complicated is building an interface to help the user to write a valid query for the current layer(s) on the map, running the query, then doing something with the result(s).

I ended up writing a bespoke solution which does all of the above, which took a good week or so of development.

My solution is embedded reasonably tightly into the rest of my mapping framework, so unfortunately it's not easy to "export" this into a stand-alone "select by attributes plugin" - possibly why nothing like this exists so far?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.