I have a project that is based on rating road condition on a scale of 1 to 10. I can achieve the desired symbol on the 1 to 10 scale through tradition default methods, but I would like to use an ARCADE expression and have a layer that is symbolized where the scale values are grouped into sets (ie. 0, 1-3, 4-6, 7-10)
So far I have a valid expression, but I am having trouble producing the desired output and figuring out how to have the expression assign colors.
This is what I I have to this point.
Solved! Go to Solution.
You're putting those values in quotes, which the parser is interpreting as strings. Try this for your if statement
if x( == 0) {
return "Not Rated";
} else if (x < 4) {
return "Good";
} else if (x < 8) {
return "Moderate";
} else {
return "Poor";
}
What is the field type of PaserScore? Is it a string or a number?
Short Integer
You're putting those values in quotes, which the parser is interpreting as strings. Try this for your if statement
if x( == 0) {
return "Not Rated";
} else if (x < 4) {
return "Good";
} else if (x < 8) {
return "Moderate";
} else {
return "Poor";
}
Many thanksKen Buja,
It works great! I would still like to have a select array of values, like in my first attempt, but I am still having trouble getting the desired output. Could you offer any advice on when x equals and array of values (ie x == 10,9,8,7)
Glad to help. Don't forget to click the "Mark Correct" button.
You can use something like this to check if your feature's field value is in a set of items of an array. You can test this in the Arcade Playground using the Popup profile
var array = [1, 2, 3];
if (indexOf(array, $feature.FLOORCOUNT) > -1) {
return "Found it"
} else {
return "Not found"
}