Hi All,
I want to create an arcade expression for symbolization of ratio ranges. I have a field that display ratios like 0.33, 0.60, and greater like 1.0. Then I want the ratios within categories in percentages like from 65% and below, from 66% to 70% and so on and last category from over 96%.
How to accomplish that? Please advice
Thank you,
Solved! Go to Solution.
Hi @DianaWilson1 ,
You can use something like this:
var ratio = $feature.Ratio; // replace by field name in your data
if (ratio <= 0.65) {
return "less than or equal to 65%";
} else if (ratio <= 0.7) {
return "from 66% to 70%";
} else if (ratio <= 0.75) {
return "from 71% to 75%";
} else if (ratio <= 0.8) {
return "from 76% to 80%";
} else if (ratio <= 0.85) {
return "from 81% to 85%";
} else if (ratio <= 0.9) {
return "from 86% to 90%";
} else if (ratio <= 0.95) {
return "from 91% to 96%";
} else {
return "96% and higher";
}
Hi @DianaWilson1 ,
I would probably do something like this:
var ratio = $feature["YR1_RATIO"]; // replace by field name in your data
if (IsEmpty(ratio)) {
return "no data";
} else if (ratio <= 0.65) {
return "less than or equal to 65%";
} else if (ratio <= 0.7) {
return "from 66% to 70%";
} else if (ratio <= 0.75) {
return "from 71% to 75%";
} else if (ratio <= 0.8) {
return "from 76% to 80%";
} else if (ratio <= 0.85) {
return "from 81% to 85%";
} else if (ratio <= 0.9) {
return "from 86% to 90%";
} else if (ratio <= 0.95) {
return "from 91% to 96%";
} else {
return "96% and higher";
}
Hi @DianaWilson1 ,
You can use something like this:
var ratio = $feature.Ratio; // replace by field name in your data
if (ratio <= 0.65) {
return "less than or equal to 65%";
} else if (ratio <= 0.7) {
return "from 66% to 70%";
} else if (ratio <= 0.75) {
return "from 71% to 75%";
} else if (ratio <= 0.8) {
return "from 76% to 80%";
} else if (ratio <= 0.85) {
return "from 81% to 85%";
} else if (ratio <= 0.9) {
return "from 86% to 90%";
} else if (ratio <= 0.95) {
return "from 91% to 96%";
} else {
return "96% and higher";
}
Alex,
Thank you so much! I just wonder if you work in my office a long time ago. You put the ratio ranges exactly how I have in my table and I just gave you one range bracket.
Best,
Diana
Hi Alex,
Thank you! I just realized that there are many null values in this field, and all of them fall in the "5% and below" bracket. I try this part in the beginning of the arcade expression, but it does not work. could you please advice how to improve this? thanks
IIF(!IsEmpty($feature.YR1_RATIO){
return""
}else{$feature.YR1_RATIO
}
Thanks,
Diana
Hi @DianaWilson1 ,
I would probably do something like this:
var ratio = $feature["YR1_RATIO"]; // replace by field name in your data
if (IsEmpty(ratio)) {
return "no data";
} else if (ratio <= 0.65) {
return "less than or equal to 65%";
} else if (ratio <= 0.7) {
return "from 66% to 70%";
} else if (ratio <= 0.75) {
return "from 71% to 75%";
} else if (ratio <= 0.8) {
return "from 76% to 80%";
} else if (ratio <= 0.85) {
return "from 81% to 85%";
} else if (ratio <= 0.9) {
return "from 86% to 90%";
} else if (ratio <= 0.95) {
return "from 91% to 96%";
} else {
return "96% and higher";
}
Thank you!