Custom conditional symbology based on multiple categorical columns

413
3
Jump to solution
12-13-2023 06:29 PM
Ed_
by MVP Regular Contributor
MVP Regular Contributor

So I have to create like two maps based on two separate sets of conditions based on the values in columns `park` and `forest`

Case 1: When both `park` and `forest` values are present color `light pink` (Also can I directly put the color name or HEX code here?). When either one of the values are present then color `light blue`

Arcade code goes here

Case2: When both values are NULL then color `light blue`.   When either one of the values are present then color `light pink`

Arcade code goes here

I did try the return function with when and logical operators but kept on getting errors. I am still new to custom symbology with Arcade so guidance will be appreciated.

Sample Data:

 

 

Park   Forest
park   forest
<Null> <Null>
park   forest
park   forest
<Null> forest
park   forest
<Null> forest
<Null> <Null>
<Null> forest
<Null> forest
<Null> <Null>
park   forest

 

 

 

Question | Analyze | Visualize
0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Just a reminder that what the expression returns will not be the exact color, but rather a string that defines a category. You can put the hex code in if you want, but for all the difference it will make to the actual symbol you may as well put "A" and "B".

var p = !IsEmpty($feature.park)
var f = !IsEmpty($feature.forest)

// case 1

return When(
  p && f, 'light pink', // both present
  p || f, 'light blue', // one present
  ''
)

// case 2

return When(
  !p && !f, 'light blue', // both NULL
  p || f, 'light pink', // either present
  ''
)
- Josh Carlson
Kendall County GIS

View solution in original post

3 Replies
Ed_
by MVP Regular Contributor
MVP Regular Contributor

@jcarlson can you please help when you have the time? cheers

Question | Analyze | Visualize
0 Kudos
jcarlson
MVP Esteemed Contributor

Just a reminder that what the expression returns will not be the exact color, but rather a string that defines a category. You can put the hex code in if you want, but for all the difference it will make to the actual symbol you may as well put "A" and "B".

var p = !IsEmpty($feature.park)
var f = !IsEmpty($feature.forest)

// case 1

return When(
  p && f, 'light pink', // both present
  p || f, 'light blue', // one present
  ''
)

// case 2

return When(
  !p && !f, 'light blue', // both NULL
  p || f, 'light pink', // either present
  ''
)
- Josh Carlson
Kendall County GIS
Ed_
by MVP Regular Contributor
MVP Regular Contributor

Thank you so much for the quick response 🙂.

Happy Holidays!

Question | Analyze | Visualize
0 Kudos