Hi
I have created a Arcade Expression for Field Calculation in Field Maps to autopopulate the address.
Im using FeatureSetByPortalItem to get featureSet from a public Norwegian Address service (called Matrikkel) and I'm getting the closest address.
Im currently on a ArcGIS portal: https://kraftnett.maps.arcgis.com/ and Field Maps App v. 22.4.0 and iOS 16.1.1
When I test the expression in the Field Maps Expression builder I get the correct result.
When I use Map Viewer to submit a SmartForm it also work and gives me the correct result.
But when I try to submit the form in the Field Maps Mobile App I get the error message failed to calculate, and The Field Maps log gives me this error message:
28/11/2022, 14:22 Expression failed to evaluate:
Name: expr/getclosestaddress0
Error: Error Domain=com.esri.arcgis.runtime.error Code=15 "Invalid call." UserInfo={NSLocalizedFailureReason=Object failed to load, unable to execute task., NSLocalizedDescription=Invalid call., Additional Message=Object failed to load, unable to execute task.}
Does Field Maps Field autofilling support the FeatureSetByPortalItem function?
ArcadeEditor gives me correct result:
SmartForm in Map Viewer gives me correct result:
Field Maps Mobile App gives error message failed to calculate:
There is no problem in getting the location in the form.
The Field Maps log gives me this error message:
28/11/2022, 14:22 Expression failed to evaluate:
Name: expr/getclosestaddress0
Error: Error Domain=com.esri.arcgis.runtime.error Code=15 "Invalid call." UserInfo={NSLocalizedFailureReason=Object failed to load, unable to execute task., NSLocalizedDescription=Invalid call., Additional Message=Object failed to load, unable to execute task.}
Im using this expression:
//GetClosestAddress
//Date || User || Version || Description
//25.11.2022 || LAROST || v1 || Arcade created
//SourceName: Matrikkel (Oversikt)
//Source URL: https://www.arcgis.com/home/item.html?id=ce048cc436d247afab84f0983af371c8
//LayerId: 0. AdressePunkt (PointLayer)
//LayerId: 5. DekTeigFlate (PolygonLayer)
var searchDist = 200;
var matrikkel = FeatureSetByPortalItem(Portal('https://www.arcgis.com'),'ce048cc436d247afab84f0983af371c8',5,['*'],true);
//var matrikkel = FeatureSetById($map, "GeomapMatrikkel - DekTeigFlate")
Console("Total number of addresses in Matrikkel:" + Count(matrikkel));
var addresses = Intersects(matrikkel, Buffer($feature, searchDist, "meters"));
var cnt = Count(addresses)
Console("Total Number of addresses within buffer:" + cnt);
if (cnt > 0) {
var nearestaddress;
var min_dist = 250;
for (var f in addresses){
var addressDist = Round(Distance(f, $feature, "meters"),2);
if (addressDist < min_dist) {
nearestaddress = f.ADRESSE + ", " + f.POSTNR + " " + f.POSTNAVN;
min_dist = addressDist;
}
Console(f.ADRESSE + ", " + f.POSTNR + " " + f.POSTNAVN + ": " + " " + addressDist + "m away");
}
return nearestaddress;
} else {
// no features found in buffer
return "N/A"
}
I have used some of this information.
Can someone help me with this? Appreciate all help I can get
@XanderBakker? @Anonymous User?
I am having the same issue on my end. Hopefully someone from ESRI can respond soon!
Im receiving the same error when trying to Navigate to a point
I am having the exact same issue, but only on iOS. Looks like you're using iOS as well. Have you tested on Android to see if you get the same error? It works for me on Android but not iOS.
Has this been resolved? I am experiencing the same issue
@MeghanBlair @JoeEastman1 @CarlosHenderson @hgnudas @LarsChristianØstgaard I am now having this same issue. Anybody find out a workaround?
From my experience with Field Maps- calling a feature by PortalID or PortalName doesn't work. You have to use $map or $feature. I haven't been able to find documentation on this, but if you use the same expression with $map it should work.
I was hopeful but doesn't work for me.