I created a web map and setup a form with a calculated field (grab property address from nearest parcel). It works in the web map and works in the Experience Builder App I built. But in the Dashboard I get the error "Failed to calculate value."
FORM Code:
var searchDist = 100;
var addresses = Intersects(FeatureSetByName($map, "City Parcels"), Buffer( $feature, searchDist, "feet"));
var nearestaddress;
var min_dist = 150;
for (var f in addresses){
var addressDist = Round(Distance(f, $feature, "feet"),2);
if (addressDist < min_dist) {
nearestaddress = f.PROP_ADD1;
min_dist = addressDist;
}
}
return nearestaddress;
I guess it might be a little more complicated because this field is only editable if another field is switched on.
Any ideas?