Select to view content in your preferred language

Unable to Group Symbology with Arcade Expression

09-13-2023 08:51 AM
Occasional Contributor

Hello everybody, I am trying to group my symbology based on unique values for my fitting repair water utility layer. There are 3 different unique values that contain "Bend" such as 22-Bend, 45-Bend, and 90-Bend. How can I group these symbols to be one symbol? I've tried simply grouping together in Pro but it publishes it 3 times like photo below. 


Then I tried using arcade expression in both Pro and Online using When / If / IIF statements and am getting no luck. In both Pro and Online it seems to only generate the "Else value" which is "Other" in my example. Online web map will say "expression must return a number value" but I plan on publishing from pro anyways, whatever can get it to work with group values.

Thank you so much for any recommendations, I am novice at using Arcade expression.


var name = $feature.FITTINGTYPE

if (name == "22-Bend" || name == "45-Bend" || name == "90-Bend") {
    return "Bend"}

if (name == "Cap" || name == "Cap - End") {
    return "Cap"} 

if (name == "Clamp (Band)" || name == "Clamp (Bell)" || name == "Clamp (Wrap)") {
    return "Clamp"} 

if (name == "Coupling") {
    return "Coupling"} 

if (name == "Tee Hydrant (Swivel)" || name == "Tee Reducing" || name == "Tee") {
    return "Tee"} 
else {
    return "Other"





0 Kudos
3 Replies
MVP Regular Contributor

Try using Decode. You can group values by separating them with commas like so:


var name = $feature.FITTINGTYPE

Decode(name, '22-bend','Bend’,'45-bend','Bend','90-bend','Bend','Cap','Cap','Cap – End','Cap', /* etc etc… */ 'Default value for all others not listed')



0 Kudos
MVP Esteemed Contributor

This code should work

var name = $feature.FITTINGTYPE;
return When(Find("Bend", name) > -1, "Bend",
            Find("Cap", name) > -1, "Cap",
            Find("Clamp", name) > -1, "Clamp",
            name == "Coupling", "Coupling", 
            Find("Tee", name) > -1, "Tee", 
0 Kudos
New Contributor

I'll apologize in advance for the half answer here. As I recall you can't do a multi-value symbology in the online map viewer. You can do it in pro and publish the layer and it will work -but you can't build it by default.

You can build an arcade expression that does the attribute combos and returns a set of unique values that you can then symbolize on .

I'm not sure if that has all changed with the new map viewer.

0 Kudos