Select by Attributes Widget v1.1 07/20/2018

07-20-2018 07:11 AM
Labels (1)

Select by Attributes Widget v1.1 07/20/2018

Hi all,


I developed a Select by Attributes Widget and I want to share it with whole community 


Visit  my Github 



I build Esri widgets without any -economic- interest, if you find it useful for your projects, you can buy me a coffee

Don't hesitate to contact me if you need some custom developments:


Labels (1)

Does this widget allow you to perform a subquery on the original query (Select features from current selection instead of running a new selection)?

Not yet, I will improve it!


Does it support all types of data sources (e.g. file gdb, sde, query layer from non-SDE spatially enabled rdbms (Oracle, SQL Server)?

This widget is awesome! 

Can I make one suggestion? 

In this example the Wisconsin needs to be 'Wisconsin'

The word needs ' ' around it. When you pick it from the unique values it does not automatically add the ' '  like arcmap does. 

Is it possible to do this? 

The widget is reading the Web Map layers, so, could be. If you embed in your Web Map a feature or map service from your ArcGIS Server that you published by registering the geodatabase, the widget is querying the data from there (e.g. file gdb, enterprise gdb)

Thanks for the observation, I just fixed it!


This widget will be perfect for me, but unfortunately I can not use this. I have to added it to my app, but when I want to configure it, it's only loading, loading and loading, nothing happen. What should I do? 


The widget needs the config.json file to work. You can set the following on manifest.json, but the widget won't work correctly

"properties": {
"hasConfig": false

Just click on 'OK'


Unfortunately I don't understand well, what should I do to work the widget correctly. Should I copy theese 3 lines to the manifest.json? Nothing happen after that. This is my config and manifest.json now (yet deleted the 3 lines you posted) #sorry_i_am_beginner

No worries

Leave your manifest.json as before, just click the (blue) 'OK' button


Yeah, I did it before posting my first comment, but it's not working, can't find any layers, it's empty. How can I can configure which layers are visible for the widget? (I use a widget, that can make SQL queris by the user, but it can't know the Get Unique Values function, so that would be a very good upgrade for me...)

Does your web map have layers?

of course. i have 34 layers in a hierarchy (some group layers that contain layer with data). i use them in some widgets, and work well in query, identify, selection, etc etc, but this enhanced query widget don't see the layers. I thougt, I have to add the URL of my MapServer or something else, and after that the widget will use theese layers. 

The widget is not getting the layers right, maybe because of the group layers. You would have to investigate the case and adapt it to your data structure.. This is just an example of my own developments. The demo is using the following web map: 

The group layer is the problem, i created another web map with 3 simple layer, and the widget works well on it.. thanks your help. 

Excellent widgets Adri2c Pérez Beneito! One thing I was wondering is if you intend to make the Select able to add the selection in to the Attribute Table widget, which would then enable Exporting. Or add as an operational layer to connect to other widgets. Alternatively you could add export to geoJson, CSV and gdb and a Summary (mean, median, mode, min, max, std dev, akin to Robert's eSearch). Great stuff, thanks for sharing! I also think your Intro.js is an outstanding idea, and I'll be leveraging that for most of my viewers I think. 

Thanks Adrian! Great job 😃

Would it possible to update this widget to use group layers and be able to configure the layers to be selectable?

I only use group layers and I don't know many people that use single layers in there layer list.


This is just an example of own developments. Maybe in the future


It is a very useful widget, thank you very much, I have the same problem as John Locke, what do you mean by using simple layers? I have a layer published from a gdb of Oracle.

Sorry, I can´t see your Web Map with the singles layers, it´s a private site.

Thanks in advance, and excuse my ignorance.
a greeting


If I know well, this widget doesn't works with group layers. If you have a map service with n (n > 1) layers, and you add it to your web map as "https://xxx:6443/arcgis/rest/yyyy/MapServer", it will add all of your layers to your web map in a group layer. BUT if you add your layers one by one, such as "https://xxx:6443/arcgis/rest/yyyy/MapServer/1" etc, you can use the widget. I mean this when I say "simple layers".


You are right!

Perfect! Thank you. Now the only problem is with Internet Explorer (mandatory in my viewer), I have to double click on the layer to change it:

dijit.byId(idForChangeEvent).on("change", lang.hitch(this, function(evt){
      this._updateFieldMultiSelect('fieldsMultiSelect', evt)
      this.selectFrom.innerHTML = 'SELECT * FROM ' + evt + ' WHERE:'

It seems that it is a jquery problem with IE ....

I do not know how to solve it, the rest works perfect.

Thanks for the help me.

I just quickly checked, you are right, there is a problem with jquery methods and IE. I'm pretty busy as usual.. but you can check the following post: javascript - jQuery this.remove() -vs.- $('#id').remove() in Internet Explorer (IE 9+) - Stack Overf... 

Seems a quick fix


First off I wanted to say thanks so much for this helpful widget!

I had a few small problems with it, one being the same as John Locke above (with the configuration stalling out), except I don't have group layers in my map. I am using WAB 2.6 with Portal, and my web app has related tables in it. I tried adding the feature service layers & related table layers separately like mentioned above, but the configuration still just spins and spins. If I look at the console I get this message.

The other issue is that I have to turn on the "Open this widget automatically when the app starts" button, otherwise when I click the widget it pulls all of the header controller widgets out of the header and into the middle top of the map. If you resize the window, it puts the tools back in the correct location. I am using the Jewelry Box theme for reference.

There is no error in the console for this either.

Thanks so much for any assistance you can provide!

Justin R.

Hi again!

Nowadays I use this widget again, but I have a problem with it. It works well with layers, that have polygon features, and layers that have point features. But layers with line features cannot see in the widget, theese layers are not in the selectable ones. What can be the solution?

Thanks for your help!


Anyone have any ideas as to how this widget could be configured for grouped map image layers?

Hi, I would love to use this widget, but I can't figure out how I'm supposed to get it into my web app.  I'm not using web app builder for developers, just regular web app builder.  So where am I supposed to put the widget so that I can access it through web app builder and insert into my web app?

Are you in AGOL or Portal?

Has anyone experienced issues with this widget when other widgets are present in a WAB application? I've noticed it causes the attribute table to behave erratically as well as the select widget.

I am in AGOL.

You’ll have to use Dev WAB in that case

Get Outlook for iOS<>


Is there a way to combine this type of "SQL Creator" with a extract tool?  

Version history
Revision #:
1 of 1
Last update:
‎07-20-2018 07:11 AM
Updated by: