Select to view content in your preferred language

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

158306
39
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 

 

Demo

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

https://ko-fi.com/adrisolid

Don't hesitate to contact me if you need some custom developments: biotekgis@gmail.com

Cheers!

Labels (1)
Attachments
Comments
MichaelVolz
Esteemed Contributor

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

Adri2cPérez_Beneito
Regular Contributor

Not yet, I will improve it!

Best

MichaelVolz
Esteemed Contributor

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

RickeyFight
MVP Regular Contributor

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? 

Adri2cPérez_Beneito
Regular Contributor

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)

Adri2cPérez_Beneito
Regular Contributor

Thanks for the observation, I just fixed it!

JohnLocke1
Emerging Contributor

Hi!

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? 

Adri2cPérez_Beneito
Regular Contributor

Hi,

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'

Cheers

JohnLocke1
Emerging Contributor

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

Adri2cPérez_Beneito
Regular Contributor

No worries

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

Cheers

JohnLocke1
Emerging Contributor

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...)

Adri2cPérez_Beneito
Regular Contributor

Does your web map have layers?

JohnLocke1
Emerging Contributor

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. 

Adri2cPérez_Beneito
Regular Contributor

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: http://adri2c.maps.arcgis.com/home/webmap/viewer.html?webmap=07fe94f4920c45c1b9c46958f86a1e55 

JohnLocke1
Emerging Contributor

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. 

by Anonymous User
Not applicable

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. 

katahV
by
Occasional Contributor

Thanks Adrian! Great job 😃

RichBell
Regular Contributor

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.

Rich

Adri2cPérez_Beneito
Regular Contributor

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

Best

MiguelGarcia_Esparza
New Member

Hello,
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

JohnLocke1
Emerging Contributor

Hello!

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

greetings

Adri2cPérez_Beneito
Regular Contributor

You are right!

MiguelGarcia_Esparza
New Member

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.

Adri2cPérez_Beneito
Regular Contributor

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

Cheers!

Justin_Richardson
Occasional Contributor

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.

JohnLocke1
Emerging Contributor

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!

LanceKirby2
Frequent Contributor

Brilliant!

LanceKirby2
Frequent Contributor

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

PersefoniKapotas
Occasional Contributor

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?

LanceKirby2
Frequent Contributor

Are you in AGOL or Portal?

LanceKirby2
Frequent Contributor

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.

PersefoniKapotas
Occasional Contributor

I am in AGOL.

LanceKirby2
Frequent Contributor

You’ll have to use Dev WAB in that case

Get Outlook for iOS<https://aka.ms/o0ukef>

PersefoniKapotas
Occasional Contributor

Thanks!

MarcoAntonio_de_Medeiros_Junio
Emerging Contributor

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

DigitalenCity
Occasional Contributor

Hi does this still work? It detects my layers but clicking execute does not produce results

DigitalenCity
Occasional Contributor

@JohnLocke1 Have you figured out the problem? It does nothing when I click "execute"

DigitalenCity_0-1669367632833.png
Edit: Nevermind got it to work. Thanks for this widget, hope you can update this @Adri2cPérez_Beneito 

Cheers

 

cmlosaria_gis
Occasional Contributor

Can anyone update this widget (with permission from author, if he is unable to anymore)?

Some small request from the author or anyone who has time in their hands. Willing to contribute some amount as a token of appreciation. IMO Esri should pick this widget up and work with Andri or within their team. This is quite essential widget to have in AGOL WAB or Exp Builder. 

Requests:
A. Make the query window space (where the query statements are being written), larger and not a just single line window. Very helpful if you have 4 or 5 fields you need to query.

cmlosaria_gis_1-1669865182759.png

B. Change the message "There expression was successfully verified" to "The query expression was successfully verified". I tried changing this in the "Widgets.js" file and re run the startup.bat file but it did not take into effect. I am not a programmer, so not sure really how to go about this. Willing to learn if anyone can point it out.

EDIT: Was able to fix this already. Edited the Widget.js inside the app's folder itself

cmlosaria_gis_0-1669864983602.png

C. Be able to display Field Alias instead of Field names. It would be very helpful for other users to understand what the field their querying is all about.

cmlosaria_gis_2-1669865441316.png


D. Display the Layer name correctly. Here, my layer is named as VN Province population but it shows some layer ID or something else

cmlosaria_gis_3-1669865621495.png

Nice to have..
In the widget itself, have the button and ability to
- Launch the attribute table
- zoom/pan to the results
- export to CSV..with options to choose which fields
- export to KML, shapefile or GDB
(Right now I use the Select widget to Zoom/pan, export to CSV and .json

These are what I can think of right now.

Not sure if some of these in the ABCD request are easy fix/configurable.

 

Cheers everyone

 

Charlie

 

cmlosaria_gis
Occasional Contributor

cmlosaria_gis_0-1670227435696.png

Hi,

Hopefully someone can help me.
How/what to edit to show actual layer name instead on layerID?

 

Version history
Last update:
‎07-20-2018 07:11 AM
Updated by:
Contributors