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."
I guess it might be a little more complicated because this field is only editable if another field is switched on.
Any ideas?
Hey @DerekBernard
I'm curious if it would be possible to use something instead of FeatureSetByName, something like FeatureSetByPortalItem perhaps, this may be able to get this sorted as the variables may not be able to be accessed. Here is the documentation here: https://developers.arcgis.com/arcade/function-reference/portal_functions/#featuresetbyportalitem
Cody
I tried changing the line and it doesn't work. I might not be using the function correctly.
Hey @DerekBernard
Pretty close! This is more what I had in mind here:
var searchDist = 100;
var portal = Portal('https://arcgis.co.beltrami.mn.us/');
var parcels = FeatureSetByPortalItem(
portal,
'9c473ed759734b9a9a5799a8c20f9e39',
0,
['PROP_ADD1'],
false
);
var addresses = Intersects(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;
Give this a shot and let me know if it's up and going!
Cody
I can't get this to work in just the web map even. Maybe I have my portal or item id wrong. Do you know how to confirm those?