ArcGIS Pro - Symbology using ARCADE Expressions

5465
5
Jump to solution
02-19-2020 05:47 AM
by Anonymous User
Not applicable

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.

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

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";
}

View solution in original post

5 Replies
KenBuja
MVP Esteemed Contributor

What is the field type of PaserScore? Is it a string or a number?

0 Kudos
by Anonymous User
Not applicable

Short Integer 

0 Kudos
KenBuja
MVP Esteemed Contributor

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";
}
by Anonymous User
Not applicable

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)

0 Kudos
KenBuja
MVP Esteemed Contributor

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"
}