Selection Widget - is this ported yet?

4113
4
05-05-2015 10:53 AM
by Anonymous User
Not applicable

Selection Widget Updated Version

Does anyone know if this will be ported to Javascript - WebApp Builder? rscheitlin mhoyland ?

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Kevin,

   I have no plans to do so and I have not seen Mark post any code in a couple of years.

by Anonymous User
Not applicable

Robert, thank you for your reply.  I hope someone can port it, it is likely beyond my capabilities at this point, although at some point I may have to attempt it.

It replicates the "Select by Attributes" tool in ArcGIS for anyone that hasn't used it.  This Flash widget let you build any query for anything, basically. Any layer, any field, and any operator. What would be even more neat is if when someone ports this, they add the ability to chain queries together. With AND, OR, and NOT operators!  We actually have something like this in an ancient viewer in-house (API 2.4) that I might be able to pull some business logic from but this would be way above my capacity at this point probably. I could share that code if it would help others though.

Currently I'm attempting to replicate this functionality with your eSearch Widget, by creating one by one a Query for each field in about a dozen layers.  It works great, although is requiring time to create. I did notice your nicely crafted JSON config file and have used that in Visual Studio to expedite this work a bit.  And to this end, I have put a reply in your eSearch widget thread with a question.

by Anonymous User
Not applicable

Example of our inhouse tool above.  It works. It uses some php and mysql and other weirdness to work, though, and upon further thought I do not think any coding patterns will translate into WAB.

This is what would be good to port to WAB (image of the Selection widget from Flash):

But re-creating the actual ArcGIS Tool, pictured below, would ultimately be the best!  Put the FULL power of Select by both Attrib and Spatial from Desktop into WAB as a Widget.  I imagine it's all exposed through the API and just a matter of developing it.  This would make WAB phenomenally powerful.    Maybe ESRI should create this as a standard widget?

0 Kudos
by Anonymous User
Not applicable

All right, apparently the REST map services take SQL syntax. Operators encode to HTML character codes in the url of course. After playing with our ancient internal viewer.

For example http://YourService.com/ArcGIS/rest/services/ServiceName/Service1/MapServer/12/query?f=json&where=NAME%20LIKE%20'%25smith%25'&returnGeometry=true&spatialRel=esriSpatialRelIntersects&outFields=*

Works, and returns the geometry and attribs of features matching the name Smith in a layer, in this case layer 12 in our service, ServiceName.

Or for example if SALE_YY < '2013'  (less than for Sale Year field) in querying a parcel layer would be

http://YourService.com/ArcGIS/rest/services/ServiceName/Service1/MapServer/12/query?f=json&where=SALE_YY%20%3C%20'2013'&returnGeometry=true&spatialRel=esriSpatialRelIntersects&outFields=* which works.

Less than or equal is just <= but %3C%3D in the url. 

To combine queries with AND ..  ...MapServer/243/query?f=json&where=SALE_YY%20%3C%3D%20'2013'%20and%20OBJECTID%20%3D%201&returnGeometry=true&spatialRel=esriSpatialRelIntersects&outFields=*  Same goes for or and not terms, put them in the same place.

Parentheses can be used as well --  /MapServer/243/query?f=json&where=SALE_YY%20%3C%3D%20'2013'%20%20not%20OBJECTID%20%3D%201%20or%20(OBJECTID%20%3E%2010%20and%20OBJECTID%20%3C%207)%20&returnGeometry=true&spatialRel=esriSpatialRelIntersects&outFields=*

Would have thought there would be samples on JS API page but I did not see any. I gleaned this notion of working with REST more out of Silverlight API threads.  Like Identify this is a biggie that most advanced map sites have, would be a nice WAB widget. I will give creating this a try!   Seems simple, just attaching this syntax into a Query, and using DOM inputs to form the query user interface. Hopefully then I will be able to display the table in the Attribute Table widget as a Results layer, and therefore be able to export to CSV too which is a site requirement here. Time to start coding!