0

I am looking for an Arcade Expression for ArcGIS Online which does the following:

If the value from field A is 222,333 or 444 OR
If the value from field B is 222,333 or 444 OR
If the value from field C is 222,333 or 444
return "Problem detected"

else return "Everything fine"

I have just found a solution for one field, but it does not take care of Field B or field C:

if ( $feature.FieldA == 111) {
return "everything fine"
}
else if ( $feature.FieldA == 222) {
return "Problem detected"
}
else if ( $feature.FieldA == 333) {
return "Problem detected"
}
else if ( $feature.FieldA == 444) {
return "Problem detected"
}
else {

return "No Values"

}

Is this even possible in Arcade?

3

A solution is to use a nested IIF() statement. Imagine the data is this:

Input

Then you would run the following field calculate on it using this scripting logic:

var problemValues = [222,333,444];
var v = iif(($feature.fA == 111 && $feature.fB == 111 && $feature.fC == 111), "OK", iif((indexOf(problemValues,$feature.fA) != 0 && indexOf(problemValues,$feature.fB) != 0 && indexOf(problemValues,$feature.fC) != 0),"no values","problem"));
return v;

The result being:

Results

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.