Select to view content in your preferred language

Set symbology based on attributes from multiple fields?

15249
4
Jump to solution
07-31-2018 02:12 PM
deleted-user-jxpbpbjlZInj
Deactivated User

I have a layer with two fields: "SafetyIssue" and "Status"

Safety issue can be either "yes" or "no". Status can be either "pending" or "completed".

I want to derive the symbology based on attributes from these two fields. If a Status is "Pending", then I want it to be displayed by SafetyIssue ("yes" or "no"). If Status is "Completed" then I want it to show a symbol that reflects that.

I'm pretty sure I have to write an expression to do this, but then I'm at a loss as for what I actually DO with the expression! 

So - what expression do I write, and then what in the world do I do with it? Or are all my assumptions wrong?! Help, please!

1 Solution

Accepted Solutions
ChrisWhitmore
Esri Regular Contributor

Hi Sunny,

There are probably better ways to tackle this but a simple way would be to use Arcade to generate a multi-variate unique types renderer and then adjust the resulting types in the ui. Using the fields you posted above (as well as the two possible values you listed for each field), the expression would look like this:

$feature.Status + ', ' + $feature.SafetyIssue

This will create unique types for all the possible combinations of the two fields in your data (which should be "pending, no", "pending, yes", "completed, no", "completed, yes"). It should give you something like this:

From there, you can then adjust labels, symbology. Here's my attempt (note you can symbolize "completed, no" and "completed,yes" to appear as if they are the same type (or you can group them under 'Other' and relabel / style as needed).

View solution in original post

4 Replies
ChrisWhitmore
Esri Regular Contributor

Hi Sunny,

There are probably better ways to tackle this but a simple way would be to use Arcade to generate a multi-variate unique types renderer and then adjust the resulting types in the ui. Using the fields you posted above (as well as the two possible values you listed for each field), the expression would look like this:

$feature.Status + ', ' + $feature.SafetyIssue

This will create unique types for all the possible combinations of the two fields in your data (which should be "pending, no", "pending, yes", "completed, no", "completed, yes"). It should give you something like this:

From there, you can then adjust labels, symbology. Here's my attempt (note you can symbolize "completed, no" and "completed,yes" to appear as if they are the same type (or you can group them under 'Other' and relabel / style as needed).

JonathanDandois
Frequent Contributor

I've found this only works if records already exist that match all desired combinations.  In other words, you won't get a symbol entry for "completed, no" if there are no data records  with Status = "Completed" and SafetyIssue = "No". So, when possible, we'll "fake it" to make entries with all possible combinations, generate the symbology/legend and then update the faked entries (delete them or revert them). I do this in Pro and in Enterprise Portal, assume it's the same in AGO. 

StevenTouzel
Occasional Contributor

Hello everyone,

I've created the expression by concatenating my two fields, but the expression seems to only search the first 2000 rows of the data and doesn't return all combinations. Is there anything I can do to get the arcade expression to query all rows and return all of the unique combinations?

StevenTouzel_0-1631915792233.png

 

0 Kudos
by Anonymous User
Not applicable

You can hand-edit the expression to add a WHEN clause to 1) allow you to list all combinations possible, and 2) make their label more readable than "3-Low" 

//pretending that X="completed" and 3="Pending Review"

when(myVar == "X-Exclude", "Completed - Exclude", myVar == "3-Low", "Pending Review - Low Risk", "Other combination " + myVar)