Hello,
I am fairly new to working with arcade expressions. How do I set up an expressions to show when there are more than 5 critical violations it will change the symbol icon?
Solved! Go to Solution.
Easy enough, then. Just have your expression check the value of that field and return a different value based on your threshold, then set the symbology accordingly. You can add additional else if blocks to give your symbols additional categories as needed.
if ($feature['critical_violations_field'] > 5) {
return "More than 5"
} else {
return "5 or fewer"
}
If not all categories are present in the result, you can manually add them.
Just add a condition to check for it, easy peasy!
if ($feature['critical_violations_field'] > 5) {
return "More than 5"
} else if ($feature['critical_violations_field'] == 0 {
return "0 Violations"
} else {
return "5 or fewer"
}
It really depends on the data. Where are the critical violations being recorded, on the layer itself, or related tables?
They are going to be in the layer itself
Easy enough, then. Just have your expression check the value of that field and return a different value based on your threshold, then set the symbology accordingly. You can add additional else if blocks to give your symbols additional categories as needed.
if ($feature['critical_violations_field'] > 5) {
return "More than 5"
} else {
return "5 or fewer"
}
If not all categories are present in the result, you can manually add them.
How do you show the symbol with 0. I have some inspections with 0 violations but they are following under the symol with fewer violations
Just add a condition to check for it, easy peasy!
if ($feature['critical_violations_field'] > 5) {
return "More than 5"
} else if ($feature['critical_violations_field'] == 0 {
return "0 Violations"
} else {
return "5 or fewer"
}
There are several ways that this can be accomplished. I found the following webinar very useful for setting up arcade expressions in ArcGIS Online: https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/create-intuitive-field-workflows...