Hello. I have an Arcade expression in ArcGIS Online that I believe is not working correctly. It is listed below
var VisualNoWorkNeeded = DomainName($feature,"PEC_Status") == "Visual No Work Needed"
var isCompleted = DomainName($feature,"No_Access_Reason") == "Completed"
var NoAccess = DomainName($feature, "No_Access_Reason") == "Other" ||
DomainName($feature, "No_Access_Reason") == "Locked Gate" ||
DomainName($feature, "No_Access_Reason") == "Landowner Refusal" ||
DomainName($feature, "No_Access_Reason") == "Animals"
var auditAccepted = DomainName($feature,"PEC_Status") == "Accepted"; // Accepted Not Accepted
var auditNotAccepted = DomainName($feature,"PEC_Status") == "Not Accepted";
var hasWorkOrder = !IsEmpty($feature["WorkOrderNumber"]); // string
var Assigned = !IsEmpty("");
var B = $feature["Veg_Score"] == "B"; // B C
var C = $feature["Veg_Score"] == "C";
var vegScore = $feature.Veg_Score; // C B
return When(
auditNotAccepted, "Audit Not Accepted",
auditAccepted, "Audit Accepted",
VisualNoWorkNeeded, "Visual No Work Needed",
isCompleted, "Work completed",
NoAccess, "Unable to Access",
hasWorkOrder, "Work order",
Assigned, "Work assigned",
B, "B",
C, "C",
vegScore
)
The problem is occurring with the part that is in bold. I am trying to get the expression to say "work order" when one exists. Right now, there are no work orders in the data and yet, every single entry is coming back with that value. I'm fairly confident that part is the problem because if I comment it out, the expression works correctly. I get the same result if I type that line like this:
var hasWorkOrder = !IsEmpty($feature.WorkOrderNumber); // string