Arcade Question - Changing Color of a Symbol

280
3
11-02-2020 05:50 AM
johnmosheim1
New Contributor III

Symbols Change the color using arcade

I am having trouble with something very simple. I have a feature layer called 28Day_Breaks that has a field called Average_28_Day_Result_PSI that has numeric values between 2,000 and 10,000. I am using for symbology a symbol with green fill color (I have the HEX #6CE830 and black outline) and I want to change the fill of the circle when Average_28_Day_Result_PSI is < 6,000 to red #E83030 and leave the fill to #6CE830 color when it's above 6000.

var BreakPercent = Round( ($feature["Average_28_Day_Result_PSI"]/6000)*100)
return BreakPercent

if (BreakPercent < 100 ) {

Return $feature["Average_28_Day_Result_PSI"]=="#E83030";
}


else {
Return $feature["Average_28_Day_Result_PSI"]=="#6CE830";
}


=====================
When I press Test
Result Value
Result 79
Type Number

The symbols in green – fill is not changing color for values of BreakPercent < 100
Any Thoughts?

JM

0 Kudos
3 Replies
KenBuja
MVP Honored Contributor

Line 2 ends the script, returning BreakPercent, so the later lines aren't run.

0 Kudos
johnmosheim1
New Contributor III

Hi Ken:

Thanks for your reply, So what would be the way around that?

1. Make another script after send line and use a second script using IIFs or When or something else?

2. Just to confirm the color of the symbol can be changed using an Arcade scrip?

John

0 Kudos
KenBuja
MVP Honored Contributor

If I understand your goal correctly, in the Change Style dialog, you would first set the custom script to be

Return iif ($feature["Average_28_Day_Result_PSI"] < 6000, "Less than 6000", "More than 6000");

and select "Types (Unique Symbols)" to set the color and shape of each result.

0 Kudos