Using Arcade to Make Rating System

1660
11
Jump to solution
12-29-2021 09:18 AM
Labels (1)
by Anonymous User
Not applicable

Hello!!

I have been looking all over Esri Community and I cannot figure out how to correctly use Arcade to form a rating system!

For some background information on what I am trying to do: I am an intern who monitors any and all pedestrian features. I take measurements such as slope, length width, gap size, signal timing, etc. to ensure that the features are ADA compliant. There is a rating system in place to help us determine the severity of the damage of the feature, if there is any at all. This rating system is an excel sheet that we manually use and we compare it to the data collected to rate the feature.

What I want to do is automate this process. I have successfully created this rating system, however, the expression I came up with is very very long and tedious to add on to. I have limited knowledge of Arcade so any help would be much appreciated!  

var cs = When($feature["cross_slope"]>2 && $feature["cross_slope"]<2.5, 8, when($feature["cross_slope"]>=2.5 && $feature["cross_slope"]<3, 7, when($feature["cross_slope"]>=3 && $feature["cross_slope"]<4, 6, when($feature["cross_slope"]>=4 && $feature["cross_slope"]<5, 5, when($feature["cross_slope"]>=5 && $feature["cross_slope"]<6, 4, when($feature["cross_slope"]>=6 && $feature["cross_slope"]<7, 3, when($feature["cross_slope"]>=7 && $feature["cross_slope"]<1000, 2, 10)))))))

var gw = when($feature["gap_width"]=='rating6gap', 6, when($feature["gap_width"]=='rating3gap', 3, when($feature["gap_width"]=='rating2gap', 2, 10)))
var lw = when($feature["lip_width"]=='rating8lip', 8, when($feature["lip_width"]=='rating6lip', 6, when($feature["lip_width"]=='rating3lip', 3, 10)))

var pa = when($feature["passing_area"]=='no', 5, 10)

var ras = when($feature["road_slope"]>$feature["running_slope"] && 5<$feature["running_slope"]<11, 9, when($feature["road_slope"]>$feature["running_slope"]>$feature["running_slope"] && 11<=$feature["running_slope"]<100, 8, 10))

var rw = when($feature["route_width"]>35 && $feature["route_width"]<36, 7, when($feature["route_width"]>32 && $feature["route_width"]<=35, 5, when($feature["route_width"]>28 && $feature["route_width"]<=32, 4, when($feature["route_width"]>24 && $feature["route_width"]<=28, 3, when($feature["route_width"]>0 && $feature["route_width"]<=24, 2, 10)))))

var rs = when($feature["running_slope"]>5 && $feature["running_slope"]<6, 8, when($feature["running_slope"]>=6 && $feature["running_slope"]<7, 7, when($feature["running_slope"]>=7 && $feature["running_slope"]<8, 6, when($feature["running_slope"]>=8 && $feature["running_slope"]<9, 5, when($feature["running_slope"]>=9 && $feature["running_slope"]<10, 4, when($feature["running_slope"]>=10 && $feature["running_slope"]<11, 3, when($feature["running_slope"]>=11 && $feature["running_slope"]<100000, 2, 10)))))))

var sub = when(cs == rs && cs != 10 && rs != 10, cs-1, when(cs == rw && rw != 10, rw-1, when(cs == lw && lw != 10, lw-1, when(cs == gw && gw !=10, gw-1, when(cs == pa && pa != 10, pa-1, when(rs == rw && rw != 10, rw-1, when(rs == lw && lw != 10, lw-1, when(rs == gw && gw != 10, gw-1, when(rs == pa && pa != 10, pa-1, when(rw == lw && lw !=10, lw-1, when(rw == gw && gw != 10, gw-1, when(rw == pa && pa != 10, pa-1, when(lw == gw && gw != 10, gw-1, when(lw == pa && pa != 10, pa-1,  when(gw ==pa && pa != 10, pa-1, 10)))))))))))))))

var total = min(cs, gw, lw, pa, rw, rs, sub)

iif(total == 10, 'Yes', 'No')
11 Replies
by Anonymous User
Not applicable

Alright I think I understand now! Thank you for helping me with this, and thank you for explaining the details. You have been very very helpful and I really appreciate it, I wouldn't have been able to figure this out without you! 

jcarlson
MVP Esteemed Contributor

You're very welcome! This post was a fun puzzle to try and sort through.

- Josh Carlson
Kendall County GIS
0 Kudos