I'm trying to create a map label that lists all of the completed surveys. If none of the surveys have been completed, I want that noted; conversely, if all of the surveys have been completed, I want that noted. That way, the surveyor doesn't need to read the whole list of completed surveys.
This is what I have so far:
var JT1 = $feature.JT
var veg1 = $feature.Veg
var plants1 = $feature.Plants
var BUOW1 = $feature.BUOW
var CBB1 = $feature.CBB
var DT1 = $feature.DT
var JD1 = $feature.JD
var JT = IIF(JT1 == "Yes", "JT; ", "");
var veg = IIF(veg1 == "Yes", "Veg; ", "");
var plants = IIF(plants1 == "Yes", "Plants; ", "");
var BUOW = IIF(BUOW1 == "Yes", "BUOW; ", "");
var CBB = IIF(CBB1 == "Yes", "CBB; ", "");
var DT = IIF(DT1 == "Yes", "DT; ", "");
var JD = IIF(JD1 == "Yes", "JD; ", "");
if (JT1 == "Yes" AND veg1 == "Yes" AND plants1 == "Yes" AND BUOW1 == "Yes" AND CBB1 == "Yes" AND DT1 == "Yes" AND JD1 == "Yes"){
return "ALL SURVEYS COMPLETED"
} else if (JT1 != "Yes" AND veg1 != "Yes" AND plants1 != "Yes" AND BUOW1 != "Yes" AND CBB1 != "Yes" AND DT1 != "Yes" AND JD1 != "Yes"){
return "NO SURVEYS COMPLETED"
} else {
return "Completed Surveys: " + JT + veg + plants + BUOW + CBB + DT + JD
}
... but I'm getting the error message:
')' expected.
Thank you in advance!
Hello @BrittanyGale do you need to use these Logical Operators rather than the word AND ?
https://developers.arcgis.com/arcade/guide/operators/#logical-operators
if (JT1 == "Yes" && veg1 == "Yes" && plants1 == "Yes" && BUOW1 == "Yes" && CBB1 == "Yes" && DT1 == "Yes" && JD1 == "Yes"){
return "ALL SURVEYS COMPLETED"
} else if (JT1 != "Yes" && veg1 != "Yes" && plants1 != "Yes" && BUOW1 != "Yes" && CBB1 != "Yes" && DT1 != "Yes" && JD1 != "Yes"){
return "NO SURVEYS COMPLETED"
} else {
return "Completed Surveys: " + JT + veg + plants + BUOW + CBB + DT + JD
}
Here's another way of doing this
var fields = ['JT', 'Veg', 'Plants', 'BUOW', 'CBB', 'DT', 'JD']
var output = []
for (var f in fields) {
var field = fields[f]
if ($feature[field] == 'Yes') Push(output, field)
}
When (Count(output) == 0, "NO SURVEYS COMPLETED",
Count(output) == 7, "ALL SURVEYS COMPLETED",
"Completed Surveys: " + Concatenate(output, "; "))