/create conditional visibility statement for multiple feature types

185
4
Jump to solution
4 weeks ago
DirkPeterson2
New Contributor III

I am trying to figure out the statement in Arcade for conditional visibility of certain attributes based on the type of feature being collected.  The types include dwellings (DWE), businesses or other structures (BOS) and defined outdoor areas (DOA).  I want to group certain attributes associated with buildings so in SQL its 'Type IN ('DWE', 'BOS')'.  There isn't an IN statement in Arcade, but there must be a way to do it, but I can't figure it out.

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Honored Contributor

Use the Includes function

 

var field= $feature.yourField;
var arr = ['DWE', 'BOS']; 
Includes(arr, field); //returns true if field value is found in the array

 

 

View solution in original post

0 Kudos
4 Replies
KenBuja
MVP Honored Contributor

Use the Includes function

 

var field= $feature.yourField;
var arr = ['DWE', 'BOS']; 
Includes(arr, field); //returns true if field value is found in the array

 

 

View solution in original post

0 Kudos
DirkPeterson2
New Contributor III

That worked!  I also came up with this.  I'm new to Arcade, so is this correct too?  

DirkPeterson2_0-1622034561042.png

 

0 Kudos
KenBuja
MVP Honored Contributor

That would work also, but as you add in more conditions, it can get unmanageable.

0 Kudos
AaronPulver
Esri Regular Contributor

In the past (not sure on the current status) that function wasn't supported by the runtime so you needed to use IndexOf. Just an FYI to make sure you validate this in the mobile app too.

0 Kudos