31

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"?

mgri
16.4k6 gold badges48 silver badges80 bronze badges
asked Nov 24, 2011 at 6:29
10
  • Did you ever find a solution to this? Commented Dec 7, 2011 at 17:17
  • Nothing yet, sorry Commented Jun 4, 2012 at 14:34
  • Do you try the find task ? help.arcgis.com/en/webapi/javascript/arcgis/samples/find_map/… Commented Nov 7, 2012 at 20:27
  • 2
    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? Commented Jan 2, 2013 at 10:39
  • 1
    @DevdattaTengshe I was hoping for something similar to this TOC sample which is easy to integrate Commented Jan 6, 2013 at 23:43

3 Answers 3

4

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

answered Nov 30, 2015 at 13:55
4

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.

answered Apr 23, 2013 at 15:43
0

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?

answered Apr 23, 2013 at 23:07

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.