Feature symbols depends on other features attribute in Web App Builder

1033
8
02-27-2018 12:47 AM
AliBarakat
Occasional Contributor II

Hello,

I have the following scenario:

i have layer X and layer Y

in layer X I have features X1 X2 X3

in layer Y I have features Y1 till Y15 for example

the symbology of features Y1 to Y5 is dependent on a field in X1

example if the field "status" in X1 is off, Y1 to Y5 becomes red

if the field "status" in X1 is on, Y1 to Y5 becomes green

same thing for the remaining features, where Y6 to Y10 in dependent on X2 and Y11 to Y15 is dependent on X3

is there a way to do that in WAB?

Thank you.

Tags (1)
0 Kudos
8 Replies
AliBarakat
Occasional Contributor II

rscheitlin‌ adding Robert maybe he has the answer for this

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ali,

  Are the values for X1-X3 status field going to change dynamically during the use of the app? Is the user going to have the ability to edit the status field?

0 Kudos
AliBarakat
Occasional Contributor II

Yes this is the case

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ali,

   Using the editor widget or some custom widget? The issue is capturing the attribute change event to trigger a new renderer symbol to be applied to layer2.

0 Kudos
AliBarakat
Occasional Contributor II

Robert,

 

The service is reading from an Oracle database, so the status field is changing from the database itself.

whenever this field is changing for X1 (for example), the color of Y1 to Y5 should change with it.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ali,

   That will be the problem so since it is not a user change in your code that makes the status field change you do not have a coded event that you can respond to to make the symbology change. So now you have to find a way to determine when the attribute value changes. So off the top of my head I would think you have to have a widget or some code in the MapManager.js that queries the feature on a specified interval to see if the attributes have changed and then react if they do.

0 Kudos
AliBarakat
Occasional Contributor II

Robert,

   Yes this might be a solution to change the symbols.

But another problem that I am facing is how to link X1 to Y1-Y5, I mean how will i connect these 2 layers?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

You don't. You just listen for the attribute changes on Layer 1 on a setInterval and then if the status field changes then you apply a different renderer/symbol to layer2.