Hi everyone,
I'm working on an ArcGIS Online map and I need some assistance with creating custom symbology using Arcade expressions. I have two fields in my dataset: 'Win/Loss' and 'MARTIN_OR_BLUE_WATER'. Here's what I'm trying to achieve:
- I want the points to be colored blue if the 'Win/Loss' field is 'Retained' or 'Win'.
- If the 'Win/Loss' field is 'Bid / Not Win', 'No Bid', or 'Loss', the points should be red.
- Additionally, I'd like the points to have a green outline if the 'MARTIN_OR_BLUE_WATER' field value is 'BLUE'.
I received a helpful response that provided the following Arcade expression solution, but all I get are gray points on the screen:
// Determine the point color based on 'Win/Loss' field values
var color = '';
If ($feature["Win/Loss"] == 'Retained' || $feature["Win/Loss"] == 'Win') {
color = 'blue'; // If 'Retained' or 'Win', set color to blue
} Else If ($feature["Win/Loss"] == 'Bid / Not Win' || $feature["Win/Loss"] == 'No Bid' || $feature["Win/Loss"] == 'Loss') {
color = 'red'; // If 'Bid / Not Win', 'No Bid', or 'Loss', set color to red
} Else {
color = 'yellow'; // Default color if none of the conditions above are met
}
// Determine if the outline should be green based on 'MARTIN_OR_BLUE_WATER' field
var outlineColor = '';
If ($feature["MARTIN_OR_BLUE_WATER"] == 'BLUE WATER') {
outlineColor = 'green'; // If 'MARTIN_OR_BLUE_WATER' is 'BLUE WATER', set outline color to green
} Else {
outlineColor = ''; // No outline if condition is not met
}
// Construct the symbol with the determined color and outlineColor
var symbol = {
"type": "simple-marker", // Use a simple marker symbol
"color": color, // Set the fill color based on 'Win/Loss' field
"outline": {
"color": outlineColor, // Set the outline color based on 'MARTIN_OR_BLUE_WATER' field
"width": 1 // Set the outline width (adjust as needed)
}
};
Return symbol;
Any idea how to fix this code to get the desired results?