AnsweredAssumed Answered

Any way to have WAB use/access parameter dependent choice lists? Or query/filter from a query?

Question asked by starlene on Apr 19, 2016
Latest reply on Sep 16, 2016 by starlene

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. 

 

  1. Open Web AppBuilder (Developer Edition) and load your Geoprocessing Service into a widget.
  2. Download the application and navigate to .\widgets\Geoprocessing
  3. You'll need to edit the Widget.js to implement the parameter dependent choice list.
  4. From what I can tell it appears that WAB queries the geoprocessing service to get the descriptions of the parameters. It then calls the _createInputNodes function to convert the parameters to the the html that is shown within the Input tab of the geoprocessing widget. Below are the steps that would be needed to implement what you're needing.
    1. Determine how to get a hook into the first drop-down. Note: I wasn't able to figure out this portion.
    2. Fetch the value from the first drop-down. The logic for this is available in the _getInputParamValues function.
    3. Use the value from the first drop-down to fetch the values needed for the filter in the second funtion. Note: I have pasted code below to show this workflow using the JS API. This would outline how the drop-down boxes would interact with each other.
    4. Update the choicelist for the input parameters via this.config.inputParams[1].choiceList = // Array from QueryTask
    5. Remove the html used for the second drop-down. The code for this will be related to the _createRemoveInputNode function in the .\Geoprocessing\editors\simpleEditor.js
    6. Add the html for the second drop-down by calling the _createInputNode function in the .\Geoprocessing\widgets\Widget.js

 

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

Attachments

Outcomes