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.
Solved! Go to Solution.
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
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
That worked! I also came up with this. I'm new to Arcade, so is this correct too?
That would work also, but as you add in more conditions, it can get unmanageable.
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.