Can I use the default filter widget or group filter widget in web application builder to filter fields in different web feature layers

1174
12
07-15-2021 02:07 PM
Labels (2)
AbdAhmad
New Contributor III

Dear All,

I am using ArcGIS enterprise 10.8 , I am using ArcGIS Web Application Builder App - Default filter widget . My Question is that I have two separate feature layers and I want to filter one field from one feature layer based on other filed from different feature layer , In other words I have a layer named "A" and a Layer named "B" , how can I use the filter widget or group filter widget or any other widgets so whenever I select the field values listed uniquely from field "X" in layer "A" , the field "Y" in layer "B" will only list the values that is correspondent to what is selected in the previous list . Please not that they are in different layers and not in the same layer (I know that it works fine if the are in the same layer) , My case is that I have main admin boundaries that have names in a layer and there is other sub admin boundaries in other layer that also has names and I want when select the name of the main admin boundary the other list that reads from  submain admin layer will show only the names on the sub admin boundaries that have belongs to the main admin boundaries (the second layer has the code for the main admin boundary).

 

Thanks 

0 Kudos
12 Replies
RPGIS
by
Regular Contributor

Hi,

 

So there are one of two of ways in which this could be accomplished, assuming that the fields have matching values. Or if the values are different, then there is the other option.

The group filter widget can have two different feature layers where the corresponding shared values can be filtered based on a specified value.

Example.JPG

 

The other option is to use the standard filter option with two different filters, where one filter is set to filter layer A with the filter expression setting to ask for values and filter two is set to filter layer B with a predefined filter expression to a default value.

  • The values for filtering layer A is then set to either unique or predefined unique values. This filter will have the users select a value to filter by.
  • The values for filtering layer B is set to whichever default value you want. (Note: you can include an expression set for layer B if there are multiple unique values that you want filtered, and then select whether the expression needs to match either any or all values in the set)
  • Then you set the display option for the widget to display the features that match all of the filters.

Give this try.

0 Kudos
AbdAhmad
New Contributor III

Dear Robert,

 

Thanks for your response. Actually the filter approach above still does not solve my proplem, Maybe I am missing something. let me ellaborate more about what I am trying to achieve using the default filter widget. I have district polygon layer that contains two fields , "DistName" : represents the name of the district , "DistCode" :contains the code of the district , I will refer to this layer as Layer "A" . I also have  another separate Polygon layer contains subdistricts and contains three fields , "SubDistName" :contains the subdistrict name , "Code" : represents the Subdistrict Code , "DistCode": contains the district code , I will refer to this layer as Layer "B" , the common field between both layers are "Distcode" , What I am trying to achieve using the default filter widget is when selecting a DistName from Layer A  (which configured in the filter expression to list the Unique Values)  , the other list that reads from Layer B field "SubdistName" is filtered to contain only the names that are only belongs to the selected "DistName" .  before I posted this I had tried similar to what explained above but unfortunately I was not able to get what I want? It works fine if I have only one layer contains both boundaries? Do I miss something!

Thanks

 

0 Kudos
RPGIS
by
Regular Contributor

In short, you want the district names in Layer A to create a sub-filter for Layer B and only include the Subdistrict names as filter values for Layer B. Is this correct?

0 Kudos
AbdAhmad
New Contributor III

Thats correct. So selecting a district name from the Layer A list will limit the list of cofiguerd based on Layer  B to include only the names of sub districts belongs to that selected district with the ability to zoom to. In other words , I am looking for a behaviour within the Web Application Builder similar to setting  filter actions between selectors in the Dashboard.

Thanks again

0 Kudos
RPGIS
by
Regular Contributor

After some testing, I came across a possible solution.

For the filter widget, here is a possible solution though not quite in the manner that you are looking for.

For the filter widget:

"Display features that match all of the filters"

  • Create filter set for Layer B
    • Choose "All of the following expressions in this set to be true"
    • Set expression "Distcode" - "contains" - select all unique values 
      • "Ask for values" unchecked
    • Set expression "SubdistName" - "is" - select unique values
      • "Ask for values" checked
  • Create filter set for Layer A
    • Choose "All of the following expressions in this set to be true"
    • Set expression "Distcode" - "contains" - select all unique values 
      • "Ask for values" unchecked
    • Set expression "DistName" - "is" - select unique values
      • "Ask for values" checked

The only other option for the filter widget (similar to above but simpler) is to add the "DistName" field to Layer B feature class and field calculate the corresponding name by joining the table for layer A to layer B. You can re-publish the layer and set the filter (similar to what was mentioned above) with the only difference for the expression is swapping out the "Distcode" for "DistName" by unique value and asking users to select a value. You can then set the "SubdistName" filter below to only allow for predefined values based on the previous filter.

As for Layer A, simply set it to filter all values that contain the district name and it should simply filter by default.

0 Kudos
AbdAhmad
New Contributor III

Dear Robert,

Unfortunately , I have tried several times to use the default filter widget to cast some actions between different layers fields , but it seems its not giving me what I want , even doing what had been suggested above (the first option) , it does not do filtering of Layer B based on selected field value from layer B. Its strange why , However , earlier I tried adding the field distname to layer B and it works fine , noting that in this case there is only one filter based on one layer , what I was trying to achieve is having the 2 layers as is and use there fields to do the filtering from one to the other!. I am not sure why this is not happening , unless we are missing the correct workflow , maybe the default filter widget is not designed to set selection filter actions between two separate layers field attributes using separate filters! , I hope someone also from ESRI Web Application Development team could join this conversation and advise us for the correct workflow to accomplish what is needed to fulfil this task considering having two layers.

Thanks Robert

0 Kudos
RPGIS
by
Regular Contributor

Your welcome AbdAhmed,

I don't think that there is a way to create a filter subset in one layer from an existing layer with similar attributes, aside from the possible suggestions previously noted, despite having common attributes to filter by. This might be a current limitation of the filter widget. I can try to see if there is any other possible solutions, but there may not be one currently. Have you tried posting the idea of creating a filter widget to utilize two layers to filter one another?

 

Also, I made a mistake of saying "contains" when I meant to say "is any of" in my previous suggestion. I tried to see if there were any other possible ways to set the filter but I could not create any.

0 Kudos
AbdAhmad
New Contributor III

Thanks Robert for you assistance , I already noticed the  "contains" issue , especially that this is valid for string fields only . In regards the Ideas , I don't post it as an idea , but I believe that this behaviour could be created using a custom widget , maybe a programmer that use to build custom widget and might read this post could share with us a custom widget that can fulfil what I am asking for!

 

0 Kudos
RPGIS
by
Regular Contributor

And that is really the purpose of sharing/posting the idea. A lot of times developers will look on here and see if there are any ideas that are worthwhile. If they find one that is and the community greatly likes the idea, then they will take a further look into it.

0 Kudos