In the simplest terms I am trying to do a nested query, such as a user can pick a 'state' and then the 'cities' in the selected state would populate as a choice list/unique values. The 'expression set' in the query tool sounds like what I need but its not since it does not update the available choices based on your first condition...sigh...
So I tried to implement this through a model-turned-GP service-GP widget based on a sample from an Esri blog (Generating a choice list from a field | ArcGIS Blog ) and thought this was THE solution.....until I realized that the behind-the-scenes validation does not get passed when used in WAB. Something so simple as having basic 'select by attribute' type functionality' is seemingly impossible in WAB!
I had someone much more knowledgeable than me take a look at the workflow and this is what they came up with conceptually as what needs to happen to get my desired workflow to be possible in WAB-- that outline is below and attached is a text file with a JS API example of what I'd like to be able to do in WAB.
Anyone else have a need to select/query and have accurate choice lists come up? The query tool is very misleading for an average user when you select a state 'Arizona' and have 'Philadelphia' come up as a choice of city in the state you just selected.
Ideally the native query tool would let you query completely. Or a 'select' tool that has the functionality like ArcMap's 'select by attributes.' I relied heavily on this type of thing in the good old Flex days.....through the kindness of talented non-Esri developers. But I'd really like to have such basic things available in WAB....or at least workarounds like filters and GP services to work and have Esri developers create some more useful widgets. Thanks for any suggestions
Thanks for posting this workflow. I know it would help if I was a programmer and could implement your workflow. Now that you have shown it is possible, I hope someone from Esri on the WAB team (perhaps dlaw-esristaff or one of his colleagues) can take a look and see if this can become core WAB functionality in the AGOL version. Queries (nested) are great in theory but when you cannot filter your second selection based on your first they are pretty useless.
If not, hopefully someone like rscheitlin will create another awesome widget that can do what we all seem to need. thanks again--
Thanks Ifeoma for the steps! However I have very little experience programming in JS or other web languages. Could you provide more detail in what files need to altered. Or is this just too complex for a little tweaking of code. Anyway - its good to know that it can actually be done.
Thanks again.
Diane
Hi Diane,
It shouldn't be too complex to implement at all. I was able to get this functionality to work by adding the code to the widget.js file. I recommend creating your own method in widget.js after all the input params are created in _createInputNode and passing both the input params and their corresponding nodes as an array to the function you create. And you can call this function in the _createInputNodes method.
Hi CE,
> In the simplest terms I am trying to do a nested query, such as a user can pick a 'state' and then the 'cities' in the selected state would populate as a choice list/unique values. The 'expression set' in the query tool sounds like what I need but its not since it does not update the available choices based on your first condition...
I think the latest Web AppBuilder update in ArcGIS Online will meet this requirement. Please see the blog post,
What’s New in Web AppBuilder for ArcGIS (September 2016) | ArcGIS Blog
(specifically the section on Filter and Query widgets)
Hope this helps,
Any chance on using this feature as the input to a GeoProcessing tool? I would be so happy..
Thanks Derek- I think this widget enhancement will be very useful-- off to read your blog post