POST

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!
... View more
3 weeks ago

1

1

14

POST

Ok, I think I'm starting to understand this a bit more. So for this set up, would I need to repeat line 14 in the same format but this time for "f3" and keep going for each field in the array? Then add "compFields[f3]" to line 17 and repeat that for each field as well?
... View more
3 weeks ago

0

3

64

POST

I'm afraid to say that I am having a hard time understanding what you have done. Arcade is still a foreign language to me so I do apologize for any silly questions, misunderstandings and a lack of correct vocabulary. To answer you question, I do need to compare every field to every other field. ("Field" as in the variables I have made such as rw2, gw, lw, etc..) What I'm having a hard time understanding is the "subComps" function, I understand that you made an empty array to start the dictionary in a way, but that is the limit of my knowledge. Your notes are very helpful, but I don't quite understand the logic, would you be able to explain it a bit? Thanks!
... View more
4 weeks ago

0

5

100

POST

Hello! Yes I am trying to compare all of them together to find the lowest rating score, and I only need the score to decrease by one even if there are multiply matches. I have put all of your input together into one expression, and it works great! var cross = $feature["cross_slope"]
var cs = When(
cross >= 7 && cross < 10000, 2,
cross >= 6 && cross < 7, 3,
cross >= 5 && cross < 6, 4,
cross >= 4 && cross < 5, 5,
cross >= 3 && cross < 4, 6,
cross >= 2.5 && cross < 3, 7,
cross > 2 && cross < 2.5, 8,
10
)
var run = $feature["running_slope"]
var rs = When(
run>5 && run<6, 8,
run>=6 && run<7, 7,
run>=7 && run<8, 6,
run>=8 && run<9, 5,
run>=9 && run<10, 4,
run>=10 && run<11, 3,
run>=11 && run<100000, 2, 10
)
var road = $feature["road_slope"]
var ras = when(
road > run && 5 < run < 11, 9,
road > run > run && 11 <= run < 100, 8, 10
)
var width = $feature["route_width"]
var rw = when(
width > 35 && width < 36, 7,
width > 32 && width <= 35, 5,
width > 28 && width <= 32, 4,
width > 24 && width <= 28, 3,
width > 0 && width <= 24, 2, 10
)
var gw = Decode($feature["gap_width"],
'rating6gap', 6,
'rating3gap', 3,
'rating2gap', 2,
10
)
var lw = Decode($feature["lip_width"],
'rating8lip', 8,
'rating6lip', 6,
'rating3lip', 3,
10
)
var pa = when(
$feature["passing_area"] == 'no', 5, 10
)
// compare two fields. if equal, return the first field's value minus 1, otherwise return 10
function compDecrease(field, compfield){
if (field != 10 && field == compfield){
return field1
}
else {
return 10
}
}
// populate an array with the perfield comparisons from compDecrease function
var comps = [
compDecrease(cs, rw),
compDecrease(cs, lw),
compDecrease(cs, gw),
compDecrease(cs, pa),
compDecrease(cs, rs),
compDecrease(rs, rw),
compDecrease(rs, lw),
compDecrease(rs, gw),
compDecrease(rs, pa),
compDecrease(rw, lw),
compDecrease(rw, gw),
compDecrease(rw, pa),
compDecrease(lw, gw),
compDecrease(lw, pa),
compDecrease(gw, pa)
]
// get the lowest value out of the comps array
var sub = min(comps)
min(cs, gw, lw, pa, rw, rs, sub) The expression as a whole is a lot cleaner and it is so much easier to read and understand! However, I must admit I am still worried about the length of the "comps" variable. For this expression it is perfect, but for some of our other forms it could get messy fast. var sub = when(wr == gw && gw !=10, wr1, when(wr == lw && lw != 10, wr1, when(wr == ll && ll != 10, wr1, when(wr == lwidth && lwidth != 10, wr1, when(wr == lrs && lrs != 10, wr1, when(wr == lcs && lcs != 10, wr1, when(lw == gw && gw != 10, lw1, when(gw == ll && ll != 10, gw1, when(gw == lwidth && lwidth != 10, gw1, when(gw == lrs && lrs != 10, gw1, when(gw == lcs && lcs != 10, gw1, when(lw == ll && ll != 10, lw1, when(lw == lwidth && lwidth != 10, lw1, when(lwidth == ll && ll != 10, lwidth1, when(lwidth == lrs && lrs != 10, lwidth1, when(lwidth == lcs && lcs != 10, lwidth1, when(lrs == lcs && lcs != 10, lrs1, when(rcs == rrs && rcs != 10, rrs1, when(rcs == rightflare && rcs != 10, rightflare1, when(rcs == rw && rcs != 10, rw1, when(rcs == lcs && rcs != 10, lcs1, when(rcs == lrs && rcs != 10, lrs1, when(rrs == rightflare && rrs != 10, rightflare1, when(rrs == rw && rrs != 10, rw1, when(rrs == lcs && rrs != 10, lcs1, when(rrs == lrs && rrs != 10, lrs1, when(rightflare == rw && rightflare != 10, rw1, when(rightflare == lcs && rightflare != 10, lcs1, when(rightflare == lrs && rightflare != 10, lrs1, when(rw == lcs && rw != 10, lcs1, when(rw == lrs && rw != 10, lrs1, when(lrs == lcs && lrs != 10, lcs1, when(rcs == wr && rcs != 10, wr1, when(rcs == gw && rcs != 10, gw1, when(rcs == ll && rcs != 10, ll1, when(rcs == lwidth && rcs != 10, lwidth1, when(rcs == lw && rcs != 10, lw1, 10)))))))))))))))))))))))))))))))))))))
var sub2 = when(rrs == wr && rrs != 10, wr1, when(rrs == gw && rrs != 10, gw1, when(rrs == ll && rrs != 10, ll1, when(rrs == lwidth && rrs != 10, lwidth1, when(rrs == lw && rrs != 10, lw1, when(rightflare == wr && rightflare != 10, wr1, when(rightflare == gw && rightflare != 10, gw1, when(rightflare == ll && rightflare != 10, ll1, when(rightflare == lwidth && rightflare != 10, lwidth1, when(rw == wr && rw != 10, wr1, when(rw == gw && rw != 10, gw1, when(rw == lwidth && rw != 10, lwidth1, when(rw == ll && rw != 10, ll1, when(rw == lw && rw != 10, lw1, when(lcs == wr && lcs != 10, wr1, when(lcs == gw && lcs != 10, gw1, when(lcs == ll && lcs != 10, ll1, when(lcs == lwidth && lcs != 10, lwidth1, when(lcs == lw && lcs != 10, lw1, when(lrs == wr && lrs != 10, wr1, when(lrs == gw && lrs != 10, gw1, when(lrs == ll && lrs != 10, ll1, when(lrs == lwidth && lrs != 10, lwidth1, when(lrs == lw && lrs != 10, lw1, when(lrs == gw && lrs != 10, gw1, when(lrs == lw && lrs != 10, lw1, when(lcs == gw && lcs != 10, gw1, when(lcs == lw && lcs != 10, lw1, when(leftflare == wr && leftflare != 10, wr1, when(leftflare == gw && leftflare != 10, gw1, when(leftflare == lw && leftflare != 10, lw1, when(leftflare == ll && leftflare != 10, ll1, when(leftflare == lwidth && leftflare != 10, lwidth1, when(leftflare == lrs && leftflare != 10, lrs1, when(leftflare == lcs && leftflare != 10, lcs1, when(leftflare == rw && leftflare != 10, rw1, when(leftflare == rrs && leftflare != 10, rrs1, when(leftflare == rcs && leftflare != 10, rcs1, when(leftflare == rightflare && leftflare != 10, rightflare1, when(cutt == wr && cutt != 10, wr1, when(cutt == gw && cutt != 10, gw1, when(cutt == lw && cutt != 10, lw1, when(cutt == ll && cutt != 10, ll1, when(cutt == lwidth && cutt != 10, lwidth1, when(cutt == lrs && cutt != 10, lrs1, when(cutt == lcs && cutt != 10, lcs1, when(cutt == rw && cutt != 10, rw1, when(cutt == rrs && cutt != 10, rrs1, when(cutt == rcs && cutt != 10, rcs1, when(cutt == leftflare && cutt != 10, leftflare1, when(cutt == rightflare && cutt != 10, rightflare1, 10) ))))))))))))))))))))))))))))))))))))))))))))))))))
var sub3 = when(leftflare2 == wr && leftflare2 != 10, wr1, when(leftflare2 == gw && leftflare2 != 10, gw1, when(leftflare2 == lw && leftflare2 != 10, lw1, when(leftflare2 == ll && leftflare2 != 10, ll1, when(leftflare2 == lwidth && leftflare2 != 10, lwidth1, when(leftflare2 == lrs && leftflare2 != 10, lrs1, when(leftflare2 == lcs && leftflare2 != 10, lcs1, when(leftflare2 == rw && leftflare2 != 10, rw1, when(leftflare2 == rrs && leftflare2 != 10, rrs1, when(leftflare2 == rcs && leftflare2 != 10, rcs1, when(leftflare2 == leftflare && leftflare2 != 10, leftflare1, when(leftflare2 == rightflare && leftflare2 != 10, rightflare1, when(leftflare2 == leftflare3 && leftflare2 != 10, leftflare31, when(leftflare2 == leftflare4 && leftflare2 != 10, leftflare41, when(leftflare2 == rightflare2 && leftflare2 != 10, rightflare21, when(leftflare2 == rightflare3 && leftflare2 != 10, rightflare31, when(leftflare2 == rightflare4 && leftflare2 != 10, rightflare41, when(leftflare2 == rw2 && leftflare2 != 10, rw21, when(leftflare2 == rw3 && leftflare2 != 10, rw31, when(leftflare2 == rw4 && leftflare2 != 10, rw41, when(leftflare2 == rrs2 && leftflare2 != 10, rrs21, when(leftflare2 == rrs3 && leftflare2 != 10, rrs31, when(leftflare2 == rrs4 && leftflare2 != 10, rrs41, when(leftflare2 == rcs2 && leftflare2 != 10, rcs21, when(leftflare2 == rcs3 && leftflare2 != 10, rcs31, when(leftflare2 == rcs3 && leftflare2 != 10, rcs31, when(leftflare2 == rcs4 && leftflare2 != 10, rcs41, when(leftflare3 == wr && leftflare3 != 10, wr1, when(leftflare3 == gw && leftflare3 != 10, gw1, when(leftflare3 == lw && leftflare3 != 10, lw1, when(leftflare3 == ll && leftflare3 != 10, ll1, when(leftflare3 == lwidth && leftflare3 != 10, lwidth1, when(leftflare3 == lrs && leftflare3 != 10, lrs1, when(leftflare3 == lcs && leftflare3 != 10, lcs1, when(leftflare3 == rw && leftflare3 != 10, rw1, when(leftflare3 == rrs && leftflare3 != 10, rrs1, when(leftflare3 == rcs && leftflare3 != 10, rcs1, when(leftflare3 == leftflare && leftflare3 != 10, leftflare1, when(leftflare3 == rightflare && leftflare3 != 10, rightflare1, when(leftflare3 == leftflare3 && leftflare3 != 10, leftflare31, when(leftflare3 == leftflare4 && leftflare3 != 10, leftflare41, when(leftflare3 == rightflare2 && leftflare3 != 10, rightflare21, when(leftflare3 == rightflare3 && leftflare3 != 10, rightflare31, when(leftflare3 == rightflare4 && leftflare3 != 10, rightflare41, when(leftflare3 == rw2 && leftflare3 != 10, rw21, when(leftflare3 == rw3 && leftflare3 != 10, rw31, when(leftflare3 == rw4 && leftflare3 != 10, rw41, when(leftflare3 == rrs2 && leftflare3 != 10, rrs21, when(leftflare3 == rrs3 && leftflare3 != 10, rrs31, when(leftflare3 == rrs4 && leftflare3 != 10, rrs41, when(leftflare3 == rcs2 && leftflare3 != 10, rcs21, when(leftflare3 == rcs3 && leftflare3 != 10, rcs31, when(leftflare3 == rcs3 && leftflare3 != 10, rcs31, when(leftflare3 == rcs4 && leftflare3 != 10, rcs41, 10))))))))))))))))))))))))))))))))))))))))))))))))))))))
var sub4 = when(leftflare4 == wr && leftflare4 != 10, wr1, when(leftflare4 == gw && leftflare4 != 10, gw1, when(leftflare4 == lw && leftflare4 != 10, lw1, when(leftflare4 == ll && leftflare4 != 10, ll1, when(leftflare4 == lwidth && leftflare4 != 10, lwidth1, when(leftflare4 == lrs && leftflare4 != 10, lrs1, when(leftflare4 == lcs && leftflare4 != 10, lcs1, when(leftflare4 == rw && leftflare4 != 10, rw1, when(leftflare4 == rrs && leftflare4 != 10, rrs1, when(leftflare4 == rcs && leftflare4 != 10, rcs1, when(leftflare4 == leftflare && leftflare4 != 10, leftflare1, when(leftflare4 == rightflare && leftflare4 != 10, rightflare1, when(leftflare4 == leftflare3 && leftflare4 != 10, leftflare31, when(leftflare4 == leftflare4 && leftflare4 != 10, leftflare41, when(leftflare4 == rightflare2 && leftflare4 != 10, rightflare21, when(leftflare4 == rightflare3 && leftflare4 != 10, rightflare31, when(leftflare4 == rightflare4 && leftflare4 != 10, rightflare41, when(leftflare4 == rw2 && leftflare4 != 10, rw21, when(leftflare4 == rw3 && leftflare4 != 10, rw31, when(leftflare4 == rw4 && leftflare4 != 10, rw41, when(leftflare4 == rrs2 && leftflare4 != 10, rrs21, when(leftflare4 == rrs3 && leftflare4 != 10, rrs31, when(leftflare4 == rrs4 && leftflare4 != 10, rrs41, when(leftflare4 == rcs2 && leftflare4 != 10, rcs21, when(leftflare4 == rcs3 && leftflare4 != 10, rcs31, when(leftflare4 == rcs3 && leftflare4 != 10, rcs31, when(leftflare4 == rcs4 && leftflare4 != 10, rcs41, when(rightflare2 == wr && rightflare2 != 10, wr1, when(rightflare2 == gw && rightflare2 != 10, gw1, when(rightflare2 == lw && rightflare2 != 10, lw1, when(rightflare2 == ll && rightflare2 != 10, ll1, when(rightflare2 == lwidth && rightflare2 != 10, lwidth1, when(rightflare2 == lrs && rightflare2 != 10, lrs1, when(rightflare2 == lcs && rightflare2 != 10, lcs1, when(rightflare2 == rw && rightflare2 != 10, rw1, when(rightflare2 == rrs && rightflare2 != 10, rrs1, when(rightflare2 == rcs && rightflare2 != 10, rcs1, when(rightflare2 == leftflare && rightflare2 != 10, leftflare1, when(rightflare2 == rightflare && rightflare2 != 10, rightflare1, when(rightflare2 == leftflare3 && rightflare2 != 10, leftflare31, when(rightflare2 == leftflare4 && rightflare2 != 10, leftflare41, when(rightflare2 == rightflare2 && rightflare2 != 10, rightflare21, when(rightflare2 == rightflare3 && rightflare2 != 10, rightflare31, when(rightflare2 == rightflare4 && rightflare2 != 10, rightflare41, when(rightflare2 == rw2 && rightflare2 != 10, rw21, when(rightflare2 == rw3 && rightflare2 != 10, rw31, when(rightflare2 == rw4 && rightflare2 != 10, rw41, when(rightflare2 == rrs2 && rightflare2 != 10, rrs21, when(rightflare2 == rrs3 && rightflare2 != 10, rrs31, when(rightflare2 == rrs4 && rightflare2 != 10, rrs41, when(rightflare2 == rcs2 && rightflare2 != 10, rcs21, when(rightflare2 == rcs3 && rightflare2 != 10, rcs31, when(rightflare2 == rcs3 && rightflare2 != 10, rcs31, when(rightflare2 == rcs4 && rightflare2 != 10, rcs41, 10))))))))))))))))))))))))))))))))))))))))))))))))))))))
var sub5 = when(rightflare3 == wr && rightflare3 != 10, wr1, when(rightflare3 == gw && rightflare3 != 10, gw1, when(rightflare3 == lw && rightflare3 != 10, lw1, when(rightflare3 == ll && rightflare3 != 10, ll1, when(rightflare3 == lwidth && rightflare3 != 10, lwidth1, when(rightflare3 == lrs && rightflare3 != 10, lrs1, when(rightflare3 == lcs && rightflare3 != 10, lcs1, when(rightflare3 == rw && rightflare3 != 10, rw1, when(rightflare3 == rrs && rightflare3 != 10, rrs1, when(rightflare3 == rcs && rightflare3 != 10, rcs1, when(rightflare3 == leftflare && rightflare3 != 10, leftflare1, when(rightflare3 == rightflare && rightflare3 != 10, rightflare1, when(rightflare3 == leftflare3 && rightflare3 != 10, leftflare31, when(rightflare3 == leftflare4 && rightflare3 != 10, leftflare41, when(rightflare3 == rightflare2 && rightflare3 != 10, rightflare21, when(rightflare3 == rightflare3 && rightflare3 != 10, rightflare31, when(rightflare3 == rightflare4 && rightflare3 != 10, rightflare41, when(rightflare3 == rw2 && rightflare3 != 10, rw21, when(rightflare3 == rw3 && rightflare3 != 10, rw31, when(rightflare3 == rw4 && rightflare3 != 10, rw41, when(rightflare3 == rrs2 && rightflare3 != 10, rrs21, when(rightflare3 == rrs3 && rightflare3 != 10, rrs31, when(rightflare3 == rrs4 && rightflare3 != 10, rrs41, when(rightflare3 == rcs2 && rightflare3 != 10, rcs21, when(rightflare3 == rcs3 && rightflare3 != 10, rcs31, when(rightflare3 == rcs3 && rightflare3 != 10, rcs31, when(rightflare3 == rcs4 && rightflare3 != 10, rcs41, when(rightflare4 == wr && rightflare4 != 10, wr1, when(rightflare4 == gw && rightflare4 != 10, gw1, when(rightflare4 == lw && rightflare4 != 10, lw1, when(rightflare4 == ll && rightflare4 != 10, ll1, when(rightflare4 == lwidth && rightflare4 != 10, lwidth1, when(rightflare4 == lrs && rightflare4 != 10, lrs1, when(rightflare4 == lcs && rightflare4 != 10, lcs1, when(rightflare4 == rw && rightflare4 != 10, rw1, when(rightflare4 == rrs && rightflare4 != 10, rrs1, when(rightflare4 == rcs && rightflare4 != 10, rcs1, when(rightflare4 == leftflare && rightflare4 != 10, leftflare1, when(rightflare4 == rightflare && rightflare4 != 10, rightflare1, when(rightflare4 == leftflare3 && rightflare4 != 10, leftflare31, when(rightflare4 == leftflare4 && rightflare4 != 10, leftflare41, when(rightflare4 == rightflare2 && rightflare4 != 10, rightflare21, when(rightflare4 == rightflare3 && rightflare4 != 10, rightflare31, when(rightflare4 == rightflare4 && rightflare4 != 10, rightflare41, when(rightflare4 == rw2 && rightflare4 != 10, rw21, when(rightflare4 == rw3 && rightflare4 != 10, rw31, when(rightflare4 == rw4 && rightflare4 != 10, rw41, when(rightflare4 == rrs2 && rightflare4 != 10, rrs21, when(rightflare4 == rrs3 && rightflare4 != 10, rrs31, when(rightflare4 == rrs4 && rightflare4 != 10, rrs41, when(rightflare4 == rcs2 && rightflare4 != 10, rcs21, when(rightflare4 == rcs3 && rightflare4 != 10, rcs31, when(rightflare4 == rcs3 && rightflare4 != 10, rcs31, when(rightflare4 == rcs4 && rightflare4 != 10, rcs41, 10))))))))))))))))))))))))))))))))))))))))))))))))))))))
var sub6 = when(rw2 == wr && rw2 != 10, wr1, when(rw2 == gw && rw2 != 10, gw1, when(rw2 == lw && rw2 != 10, lw1, when(rw2 == ll && rw2 != 10, ll1, when(rw2 == lwidth && rw2 != 10, lwidth1, when(rw2 == lrs && rw2 != 10, lrs1, when(rw2 == lcs && rw2 != 10, lcs1, when(rw2 == rw && rw2 != 10, rw1, when(rw2 == rrs && rw2 != 10, rrs1, when(rw2 == rcs && rw2 != 10, rcs1, when(rw2 == leftflare && rw2 != 10, leftflare1, when(rw2 == rightflare && rw2 != 10, rightflare1, when(rw2 == leftflare3 && rw2 != 10, leftflare31, when(rw2 == leftflare4 && rw2 != 10, leftflare41, when(rw2 == rightflare2 && rw2 != 10, rightflare21, when(rw2 == rightflare3 && rw2 != 10, rightflare31, when(rw2 == rightflare4 && rw2 != 10, rightflare41, when(rw2 == rw2 && rw2 != 10, rw21, when(rw2 == rw3 && rw2 != 10, rw31, when(rw2 == rw4 && rw2 != 10, rw41, when(rw2 == rrs2 && rw2 != 10, rrs21, when(rw2 == rrs3 && rw2 != 10, rrs31, when(rw2 == rrs4 && rw2 != 10, rrs41, when(rw2 == rcs2 && rw2 != 10, rcs21, when(rw2 == rcs3 && rw2 != 10, rcs31, when(rw2 == rcs3 && rw2 != 10, rcs31, when(rw2 == rcs4 && rw2 != 10, rcs41, when(rw3 == wr && rw3 != 10, wr1, when(rw3 == gw && rw3 != 10, gw1, when(rw3 == lw && rw3 != 10, lw1, when(rw3 == ll && rw3 != 10, ll1, when(rw3 == lwidth && rw3 != 10, lwidth1, when(rw3 == lrs && rw3 != 10, lrs1, when(rw3 == lcs && rw3 != 10, lcs1, when(rw3 == rw && rw3 != 10, rw1, when(rw3 == rrs && rw3 != 10, rrs1, when(rw3 == rcs && rw3 != 10, rcs1, when(rw3 == leftflare && rw3 != 10, leftflare1, when(rw3 == rightflare && rw3 != 10, rightflare1, when(rw3 == leftflare3 && rw3 != 10, leftflare31, when(rw3 == leftflare4 && rw3 != 10, leftflare41, when(rw3 == rightflare2 && rw3 != 10, rightflare21, when(rw3 == rightflare3 && rw3 != 10, rightflare31, when(rw3 == rightflare4 && rw3 != 10, rightflare41, when(rw3 == rw2 && rw3 != 10, rw21, when(rw3 == rw3 && rw3 != 10, rw31, when(rw3 == rw4 && rw3 != 10, rw41, when(rw3 == rrs2 && rw3 != 10, rrs21, when(rw3 == rrs3 && rw3 != 10, rrs31, when(rw3 == rrs4 && rw3 != 10, rrs41, when(rw3 == rcs2 && rw3 != 10, rcs21, when(rw3 == rcs3 && rw3 != 10, rcs31, when(rw3 == rcs3 && rw3 != 10, rcs31, when(rw3 == rcs4 && rw3 != 10, rcs41, 10))))))))))))))))))))))))))))))))))))))))))))))))))))))
var sub7 = when(rw4 == wr && rw4 != 10, wr1, when(rw4 == gw && rw4 != 10, gw1, when(rw4 == lw && rw4 != 10, lw1, when(rw4 == ll && rw4 != 10, ll1, when(rw4 == lwidth && rw4 != 10, lwidth1, when(rw4 == lrs && rw4 != 10, lrs1, when(rw4 == lcs && rw4 != 10, lcs1, when(rw4 == rw && rw4 != 10, rw1, when(rw4 == rrs && rw4 != 10, rrs1, when(rw4 == rcs && rw4 != 10, rcs1, when(rw4 == leftflare && rw4 != 10, leftflare1, when(rw4 == rightflare && rw4 != 10, rightflare1, when(rw4 == leftflare3 && rw4 != 10, leftflare31, when(rw4 == leftflare4 && rw4 != 10, leftflare41, when(rw4 == rightflare2 && rw4 != 10, rightflare21, when(rw4 == rightflare3 && rw4 != 10, rightflare31, when(rw4 == rightflare4 && rw4 != 10, rightflare41, when(rw4 == rw2 && rw4 != 10, rw21, when(rw4 == rw3 && rw4 != 10, rw31, when(rw4 == rw4 && rw4 != 10, rw41, when(rw4 == rrs2 && rw4 != 10, rrs21, when(rw4 == rrs3 && rw4 != 10, rrs31, when(rw4 == rrs4 && rw4 != 10, rrs41, when(rw4 == rcs2 && rw4 != 10, rcs21, when(rw4 == rcs3 && rw4 != 10, rcs31, when(rw4 == rcs3 && rw4 != 10, rcs31, when(rw4 == rcs4 && rw4 != 10, rcs41, when(rrs2 == wr && rrs2 != 10, wr1, when(rrs2 == gw && rrs2 != 10, gw1, when(rrs2 == lw && rrs2 != 10, lw1, when(rrs2 == ll && rrs2 != 10, ll1, when(rrs2 == lwidth && rrs2 != 10, lwidth1, when(rrs2 == lrs && rrs2 != 10, lrs1, when(rrs2 == lcs && rrs2 != 10, lcs1, when(rrs2 == rw && rrs2 != 10, rw1, when(rrs2 == rrs && rrs2 != 10, rrs1, when(rrs2 == rcs && rrs2 != 10, rcs1, when(rrs2 == leftflare && rrs2 != 10, leftflare1, when(rrs2 == rightflare && rrs2 != 10, rightflare1, when(rrs2 == leftflare3 && rrs2 != 10, leftflare31, when(rrs2 == leftflare4 && rrs2 != 10, leftflare41, when(rrs2 == rightflare2 && rrs2 != 10, rightflare21, when(rrs2 == rightflare3 && rrs2 != 10, rightflare31, when(rrs2 == rightflare4 && rrs2 != 10, rightflare41, when(rrs2 == rw2 && rrs2 != 10, rw21, when(rrs2 == rw3 && rrs2 != 10, rw31, when(rrs2 == rw4 && rrs2 != 10, rw41, when(rrs2 == rrs2 && rrs2 != 10, rrs21, when(rrs2 == rrs3 && rrs2 != 10, rrs31, when(rrs2 == rrs4 && rrs2 != 10, rrs41, when(rrs2 == rcs2 && rrs2 != 10, rcs21, when(rrs2 == rcs3 && rrs2 != 10, rcs31, when(rrs2 == rcs3 && rrs2 != 10, rcs31, when(rrs2 == rcs4 && rrs2 != 10, rcs41, 10))))))))))))))))))))))))))))))))))))))))))))))))))))))
var sub8 = when(rrs3 == wr && rrs3 != 10, wr1, when(rrs3 == gw && rrs3 != 10, gw1, when(rrs3 == lw && rrs3 != 10, lw1, when(rrs3 == ll && rrs3 != 10, ll1, when(rrs3 == lwidth && rrs3 != 10, lwidth1, when(rrs3 == lrs && rrs3 != 10, lrs1, when(rrs3 == lcs && rrs3 != 10, lcs1, when(rrs3 == rw && rrs3 != 10, rw1, when(rrs3 == rrs && rrs3 != 10, rrs1, when(rrs3 == rcs && rrs3 != 10, rcs1, when(rrs3 == leftflare && rrs3 != 10, leftflare1, when(rrs3 == rightflare && rrs3 != 10, rightflare1, when(rrs3 == leftflare3 && rrs3 != 10, leftflare31, when(rrs3 == leftflare4 && rrs3 != 10, leftflare41, when(rrs3 == rightflare2 && rrs3 != 10, rightflare21, when(rrs3 == rightflare3 && rrs3 != 10, rightflare31, when(rrs3 == rightflare4 && rrs3 != 10, rightflare41, when(rrs3 == rw2 && rrs3 != 10, rw21, when(rrs3 == rw3 && rrs3 != 10, rw31, when(rrs3 == rw4 && rrs3 != 10, rw41, when(rrs3 == rrs2 && rrs3 != 10, rrs21, when(rrs3 == rrs3 && rrs3 != 10, rrs31, when(rrs3 == rrs4 && rrs3 != 10, rrs41, when(rrs3 == rcs2 && rrs3 != 10, rcs21, when(rrs3 == rcs3 && rrs3 != 10, rcs31, when(rrs3 == rcs3 && rrs3 != 10, rcs31, when(rrs3 == rcs4 && rrs3 != 10, rcs41, when(rrs4 == wr && rrs4 != 10, wr1, when(rrs4 == gw && rrs4 != 10, gw1, when(rrs4 == lw && rrs4 != 10, lw1, when(rrs4 == ll && rrs4 != 10, ll1, when(rrs4 == lwidth && rrs4 != 10, lwidth1, when(rrs4 == lrs && rrs4 != 10, lrs1, when(rrs4 == lcs && rrs4 != 10, lcs1, when(rrs4 == rw && rrs4 != 10, rw1, when(rrs4 == rrs && rrs4 != 10, rrs1, when(rrs4 == rcs && rrs4 != 10, rcs1, when(rrs4 == leftflare && rrs4 != 10, leftflare1, when(rrs4 == rightflare && rrs4 != 10, rightflare1, when(rrs4 == leftflare3 && rrs4 != 10, leftflare31, when(rrs4 == leftflare4 && rrs4 != 10, leftflare41, when(rrs4 == rightflare2 && rrs4 != 10, rightflare21, when(rrs4 == rightflare3 && rrs4 != 10, rightflare31, when(rrs4 == rightflare4 && rrs4 != 10, rightflare41, when(rrs4 == rw2 && rrs4 != 10, rw21, when(rrs4 == rw3 && rrs4 != 10, rw31, when(rrs4 == rw4 && rrs4 != 10, rw41, when(rrs4 == rrs2 && rrs4 != 10, rrs21, when(rrs4 == rrs3 && rrs4 != 10, rrs31, when(rrs4 == rrs4 && rrs4 != 10, rrs41, when(rrs4 == rcs2 && rrs4 != 10, rcs21, when(rrs4 == rcs3 && rrs4 != 10, rcs31, when(rrs4 == rcs3 && rrs4 != 10, rcs31, when(rrs4 == rcs4 && rrs4 != 10, rcs41, 10))))))))))))))))))))))))))))))))))))))))))))))))))))))
var sub9 = when(rcs4 == wr && rcs4 != 10, wr1, when(rcs4 == gw && rcs4 != 10, gw1, when(rcs4 == lw && rcs4 != 10, lw1, when(rcs4 == ll && rcs4 != 10, ll1, when(rcs4 == lwidth && rcs4 != 10, lwidth1, when(rcs4 == lrs && rcs4 != 10, lrs1, when(rcs4 == lcs && rcs4 != 10, lcs1, when(rcs4 == rw && rcs4 != 10, rw1, when(rcs4 == rrs && rcs4 != 10, rrs1, when(rcs4 == rcs && rcs4 != 10, rcs1, when(rcs4 == leftflare && rcs4 != 10, leftflare1, when(rcs4 == rightflare && rcs4 != 10, rightflare1, when(rcs4 == leftflare3 && rcs4 != 10, leftflare31, when(rcs4 == leftflare4 && rcs4 != 10, leftflare41, when(rcs4 == rightflare2 && rcs4 != 10, rightflare21, when(rcs4 == rightflare3 && rcs4 != 10, rightflare31, when(rcs4 == rightflare4 && rcs4 != 10, rightflare41, when(rcs4 == rw2 && rcs4 != 10, rw21, when(rcs4 == rw3 && rcs4 != 10, rw31, when(rcs4 == rw4 && rcs4 != 10, rw41, when(rcs4 == rrs2 && rcs4 != 10, rrs21, when(rcs4 == rrs3 && rcs4 != 10, rrs31, when(rcs4 == rrs4 && rcs4 != 10, rrs41, when(rcs4 == rcs2 && rcs4 != 10, rcs21, when(rcs4 == rcs3 && rcs4 != 10, rcs31, when(rcs4 == rcs3 && rcs4 != 10, rcs31, when(rcs4 == rcs4 && rcs4 != 10, rcs41, when(rcs3 == wr && rcs3 != 10, wr1, when(rcs3 == gw && rcs3 != 10, gw1, when(rcs3 == lw && rcs3 != 10, lw1, when(rcs3 == ll && rcs3 != 10, ll1, when(rcs3 == lwidth && rcs3 != 10, lwidth1, when(rcs3 == lrs && rcs3 != 10, lrs1, when(rcs3 == lcs && rcs3 != 10, lcs1, when(rcs3 == rw && rcs3 != 10, rw1, when(rcs3 == rrs && rcs3 != 10, rrs1, when(rcs3 == rcs && rcs3 != 10, rcs1, when(rcs3 == leftflare && rcs3 != 10, leftflare1, when(rcs3 == rightflare && rcs3 != 10, rightflare1, when(rcs3 == leftflare3 && rcs3 != 10, leftflare31, when(rcs3 == leftflare4 && rcs3 != 10, leftflare41, when(rcs3 == rightflare2 && rcs3 != 10, rightflare21, when(rcs3 == rightflare3 && rcs3 != 10, rightflare31, when(rcs3 == rightflare4 && rcs3 != 10, rightflare41, when(rcs3 == rw2 && rcs3 != 10, rw21, when(rcs3 == rw3 && rcs3 != 10, rw31, when(rcs3 == rw4 && rcs3 != 10, rw41, when(rcs3 == rrs2 && rcs3 != 10, rrs21, when(rcs3 == rrs3 && rcs3 != 10, rrs31, when(rcs3 == rrs4 && rcs3 != 10, rrs41, when(rcs3 == rcs2 && rcs3 != 10, rcs21, when(rcs3 == rcs3 && rcs3 != 10, rcs31, when(rcs3 == rcs3 && rcs3 != 10, rcs31, when(rcs3 == rcs4 && rcs3 != 10, rcs41, 10))))))))))))))))))))))))))))))))))))))))))))))))))))))
var sub10 = when(rcs2 == wr && rcs2 != 10, wr1, when(rcs2 == gw && rcs2 != 10, gw1, when(rcs2 == lw && rcs2 != 10, lw1, when(rcs2 == ll && rcs2 != 10, ll1, when(rcs2 == lwidth && rcs2 != 10, lwidth1, when(rcs2 == lrs && rcs2 != 10, lrs1, when(rcs2 == lcs && rcs2 != 10, lcs1, when(rcs2 == rw && rcs2 != 10, rw1, when(rcs2 == rrs && rcs2 != 10, rrs1, when(rcs2 == rcs && rcs2 != 10, rcs1, when(rcs2 == leftflare && rcs2 != 10, leftflare1, when(rcs2 == rightflare && rcs2 != 10, rightflare1, when(rcs2 == leftflare3 && rcs2 != 10, leftflare31, when(rcs2 == leftflare4 && rcs2 != 10, leftflare41, when(rcs2 == rightflare2 && rcs2 != 10, rightflare21, when(rcs2 == rightflare3 && rcs2 != 10, rightflare31, when(rcs2 == rightflare4 && rcs2 != 10, rightflare41, when(rcs2 == rw2 && rcs2 != 10, rw21, when(rcs2 == rw3 && rcs2 != 10, rw31, when(rcs2 == rw4 && rcs2 != 10, rw41, when(rcs2 == rrs2 && rcs2 != 10, rrs21, when(rcs2 == rrs3 && rcs2 != 10, rrs31, when(rcs2 == rrs4 && rcs2 != 10, rrs41, when(rcs2 == rcs2 && rcs2 != 10, rcs21, when(rcs2 == rcs3 && rcs2 != 10, rcs31, when(rcs2 == rcs3 && rcs2 != 10, rcs31, when(rcs2 == rcs4 && rcs2 != 10, rcs41, 10)))))))))))))))))))))))))))
var sub11 = when(cc == wr && cc != 10, wr1, when(cc == gw && cc != 10, gw1, when(cc == lw && cc != 10, lw1, when(cc == lwidth && cc != 10, lwidth1, when(cc == lrs && cc != 10, lrs1, when(cc == lcs && cc != 10, lcs1, when(cc == rw && cc != 10, rw1, when(cc == rw2 && cc != 10, rw21, when(cc == rw3 && cc != 10, rw31, when(cc == rw4 && cc != 10, rw41, when(cc == rrs && cc != 10, rrs1, when(cc == rrs2 && cc != 10, rrs21, when(cc == rrs3 && cc != 10, rrs31, when(cc == rrs4 && cc != 10, rrs41, when(cc == rcs && cc != 10, rcs1, when(cc == rcs2 && cc != 10, rcs21, when(cc == rcs3 && cc != 10, rcs31, when(cc == rcs4 && cc != 10, rcs41, when(cc == leftflare && cc != 10, leftflare1, when(cc == leftflare2 && cc != 10, leftflare21, when(cc == leftflare3 && cc != 10, leftflare31, when(cc == leftflare4 && cc != 10, leftflare41, when(cc == rightflare && cc != 10, rightflare1, when(cc == rightflare2 && cc != 10, rightflare21, when(cc == rightflare3 && cc != 10, rightflare31, when(cc == rightflare4 && cc != 10, rightflare41, when(cc == cutt && cc != 10, cutt1, 10)))))))))))))))))))))))))))
var total= min(sub11, cc, wr, gw, lw, ll, lwidth, lrs, lcs, rw, rrs, rcs, leftflare, rightflare, sub, sub2, sub3, leftflare2, leftflare3, leftflare4, rightflare2, rightflare3, rightflare4, rw2, rw3, rw4, rrs2, rrs3, rrs4, rcs2, rcs3, rcs4, sub4, sub5, sub6, sub7, sub8, sub9, sub10)
iif(total == 10,'Yes', 'No') This is the longest expression that I work with. As you can see, this is only determining if there is the same rating then decreasing it by 1. I put my expressions in a Word Doc to save them, and this expression alone takes up around 5 pages. ( I'm no expert but that seems a little bit too long!) The expression you gave me is absolutely wonderful and it would still make this so much easier to deal with! But do you know of anything that could make this process shorter? You mentioned potentially using loops, how would that work? Thank you again for all of your help, I really really appreciate it!!
... View more
4 weeks ago

0

7

104

POST

Wonderful! Thank you for the advice! This looks a lot cleaner than my original function. My next question is what should I do about the function on line 14? On line 14, the intended point of the function was to find 2 variables/fields that had the same rating and then because they are the same, the rating would go down one. So lets say that $feature["cross_slope"] and $feature["running_slope"] both equal a rating of 7, because they are the same, the total rating would be 6. Then at the end we take the worst (lowest) total rating out of all of them. We are expanding our operation of collecting data, this means that we need to add more fields and more conditions in our forms and expressions. I have similar functions to line 14 that are about 3 or 4 times as long and it is very very difficult to read through, it is especially difficult to add on to it. Is there any way to try and make it cleaner? I have experimented with user defined functions and I cannot seem to get it to work for this one. Thank you again for your help!!
... View more
4 weeks ago

0

9

124

POST

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, cs1, when(cs == rw && rw != 10, rw1, when(cs == lw && lw != 10, lw1, when(cs == gw && gw !=10, gw1, when(cs == pa && pa != 10, pa1, when(rs == rw && rw != 10, rw1, when(rs == lw && lw != 10, lw1, when(rs == gw && gw != 10, gw1, when(rs == pa && pa != 10, pa1, when(rw == lw && lw !=10, lw1, when(rw == gw && gw != 10, gw1, when(rw == pa && pa != 10, pa1, when(lw == gw && gw != 10, gw1, when(lw == pa && pa != 10, pa1, when(gw ==pa && pa != 10, pa1, 10)))))))))))))))
var total = min(cs, gw, lw, pa, rw, rs, sub)
iif(total == 10, 'Yes', 'No')
... View more
4 weeks ago

1

11

154

POST

I see. Thank you for the clarification! Do you know of a way to achieve what I am describing?
... View more
12022021
11:30 AM

0

0

62

POST

I could have made the same mistake, I will have to do some further testing to see if that is what I did. I really appreciate you posting your questions and discoveries, I am somewhat new to Esri and I need as much help as I can get :)
... View more
11082021
12:56 PM

0

0

90

POST

Hello! This happened to me when I was using Map Viewer Classic to configure pop ups. I spoke to someone at Esri about it and they thought it might be a compatibility issue between Map Viewer Classic and Field Maps. I have made changes to the pop up in the New Map Viewer and it has not yet deleted my forms in Field Maps. What I have gathered is don't save anything in Map Viewer Classic, only press "Save" in the New Map Viewer when making changes to anything map related. Hope this helps!
... View more
11082021
12:19 PM

0

2

98

POST

Hello! I am in the process of making forms with Field Maps and using default values to do so. In the process I found the Zone Lookup App, and my question is, can you input the value from the polygon into a field as a default value? For example: my workflow requires users to fill out forms while inspecting utilities such as manholes and electrical poles, one of the questions the users must full out is a "Priority of Area" question. (this question helps us determine what utility should be prioritized) I want to submit a point (via Field Maps) and based on the area (in this case a polygon) have the default priority from said polygon show up in the "Priority of Area" question. Can this be done? I am new to the world of GIS and coding and I am eager to learn! Thanks!!
... View more
10262021
11:13 AM

0

2

142

Online Status 
Offline

Date Last Visited 
2 weeks ago
