Problem adding an enhancement to the Filter widget

01-09-2021 05:58 AM
New Contributor III


I'm quite new in the development of widgets for WAB. I use ArcGIS enterprise portal 10.6 and WAB developer edition 2.10.

I have an application that uses data that is updated every two weeks or every month. For every new batch of data I replace the FGDB in the registered folder and the next time the users open the application, it shows the new data. As part of the application, we have a Filter widget that filters the Year field (integer) and the Month field (integer). Since most of the users want to check the last month data, the default values of the filter have to be the last month and year. Until now, every time we receive new data, we enter the application, manually change the default month and year of the filter, save and copy the application to the right folder in the IIS server.

I'd like to automate that process so the filter widget in the application checks the data, finds the last month and year and sets the default values of the filter.

A simple approach could be a script, external to the application, that reads the new data and do some changes to the filter widget JSON, as shown in the next lines:

"parts": [
"fieldObj": {
"name": "Year",
"label": "Year",
"dateFormat": "",
"shortType": "number",
"type": "esriFieldTypeDouble"
"operator": "numberOperatorIs",
"valueObj": {
"isValid": true,
"type": "unique",
"value": 2020
"interactiveObj": {
"prompt": "Year is",
"hint": "",
"cascade": "previous"
"caseSensitive": false,
"displaySQL": "Year = 2020",
"expr": "Year = 2020"

This is easy to achieve but is not the automation I'm willing to use.

Instead, I'd like to find where the configuration data, read from the above JSON file, resides within the application and change it programmatically every time that the application opens/loads the filter widget - I guess it should be in the PostCreate function, using the Query function.

I've looked for it in the debugger and couldn't find where the data is, so I'm kindly asking for your assistance.

Thank you in advance,


4 Replies
Esri Contributor

Hi, please take a look at FilterParameter to see if that is what you after.


Which is reference in widget.js. From memory the sql expression is build from there. Hope that helps :)




0 Kudos
New Contributor III

Hello @VictorTey  and thank you for your response!

I will check your suggestion that looks very promising and I will also check another option, suggested by another colleague, to use the 'config' component of the widget. I will certainly write my results here.

Meanwhile I found another problem when trying to deal with the queryTask asynchronous function. I use queryTask once in order to get the higher Year value and once again to get the higher Month value during that year. This means two sequential queries that have to get their result before the widget is displayed in the screen. After executing the queryTask, I cannot find the way to make the program wait for the result. I'd appreciate some help here...

Thank you,


0 Kudos
New Contributor III

First of all, it worked!!!

Secondly, I'm far from understanding how :thinking_face:

I found five properties with values from the widget configuration:


I played with it a little bit and found that setting the last one worked fine:[0].valueObj.value = 2021;

The widget showed the right default value and, when applied, it filtered the data right.

I still have the problem of where and how to get the year value (2021) from the data layer, before the program sets the filter value. I'd appreciate a comment on the new issue or maybe I should post another thread?

Thanks again,


0 Kudos
Esri Contributor

Hi Marcelo,

Hope i am not interpreting your question wrongly.

even after the widget have set the filter value, those values can still be changed. but you will likely have to modify and customize FilterParameter.js. The easiest way to do this is to take a copy from

WebAppBuilderForArcGIS\client\stemapp\jimu.js\dijit\FilterParameter.js and store it locally. THen update your reference to 

'jimu/dijit/FilterParameters' and change it your local reference. (Note you made need to update or copy over the  references in FilterParameter as well). I hope that is helpful.
So depending if you are using _SingleFilterParameter or _filter/ValueProviderFactory you can update the default value. For example take a look at