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
Not at all. I had to abandon the idea and only use datasets where I could hard code my values into a value list for a parameter. If the query widget had the filter ability (like the 3rd party tool) I could at least use that to generate my lists as another less-than-ideal solution but still no dice.
I was hoping someone at least would have commented that this is easy/way hard/etc but I guess no one else out there thinks being able to use the same validation tools/choice lists/etc in desktop is important in WAB
I've logged enhancement requests for similar functionality so maybe they will go somewhere
So what you want can be done I believe,
This is for an old form of WAB but you should be able to def query in the drop down idea you want.
Thanks for the link, I certainly did not see this. I will examine more closely tomorrow, but it still looks to me that you have to define your list (the first step defining the option values). I have lots of unique values so I am trying to avoid defining them. BUt this may be promising if I can devote time to developing (I am dev lite, heavy on the lite )
Has anyone figured out how to have WAB dynamically populate the list of fields from a feature class selected in a GP widget? The choice list is always hard coded when upload my GP service. Is there something I am missing in the parameter definitions?
Thanks in advance.
No idea- I have yet to get anything to work with WAB and populated lists from a GP service. The query widger seems like the logical place for this functionality to live, but since the filters do not populate lists based on your first choice, its useless to me. Hope someone figures this out-
I have figured out a way to have a dynamic parameters (whether it's a drop down or multi select widget) based on a selected value from another parameter in my WAB gp widget.
My suggested workflow:
1). On your GP widget UI, find the widget ID of the parameter you want to monitor using dijit.byId or registry.byId.
2). Create an event handler to watch for changes in value to this editor and capture the value it was changed to
3). Write the code to create the variables with your desired dynamic values based on what was selected in step 1 using if/then statements, getting results from a GP service, or whatever logic you need, etc
4). Find the widget ID of the parameter that needs to be dynamically changed based on the value selected in step 1.
5). Use registry.byId's set/reset method to update the values of the widget in step 4 dynamically with the variables you created.
Note: you may have to use dojo/ready and dojo/connect to make sure your widget is fully loaded.
Hope this helps!