Primary Symbology > Unique Values > Expression Builder

360
2
Jump to solution
09-23-2022 12:29 PM
TylerT
by
Occasional Contributor III

Hello,

I need some help building the following pseudo code expression for unique value symbology, expressed in Arcade:

Pseudo Code:

list1 = ['a', 'b',...]
list2 = [ 'w', 'x',...]

if field1_val in list1 AND field2_val in list2:
   return 1
else:
   return 'other'

Much appreciated.

Tyler

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

We can use Includes to check whether the values are present, than Iif to evaluate the two together:

var list_a = ['a', 'b', ...]
var list_b = ['w', 'x', ...]

var a = $feature['attribute_a']
var b = $feature['attribute_b']

var in_a = Includes(list_a, a)
var in_b = Includes(list_b, b)

return Iif(in_a && in_b, 1, 'other')

 

- Josh Carlson
Kendall County GIS

View solution in original post

2 Replies
jcarlson
MVP Esteemed Contributor

We can use Includes to check whether the values are present, than Iif to evaluate the two together:

var list_a = ['a', 'b', ...]
var list_b = ['w', 'x', ...]

var a = $feature['attribute_a']
var b = $feature['attribute_b']

var in_a = Includes(list_a, a)
var in_b = Includes(list_b, b)

return Iif(in_a && in_b, 1, 'other')

 

- Josh Carlson
Kendall County GIS
TylerT
by
Occasional Contributor III

@jcarlson; What took you so long?  9 minutes?  😉... I'll give that a whirl.  Much appreciated!  Tyler