Field Maps Arcade - FeatureSetByPortalItem - Failed to calculate (Object failed to load, unable to execute task)

568
2
11-25-2022 12:15 AM
Labels (2)
LarsChristianØstgaard
New Contributor III

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:

ArcadeEditor ok.png

 

SmartForm in Map Viewer gives me correct result:

Arcade MapViewer ok.png

 

Field Maps Mobile App gives error message failed to calculate:

There is no problem in getting the location in the form.

Arcade FieldMaps not ok.jpg

 

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.

https://community.esri.com/t5/arcgis-online-questions/using-arcade-to-find-the-nearest-address-point...

 

Can someone help me with this? Appreciate all help I can get 

@XanderBakker@AaronPulver?

2 Replies
hgnudas
New Contributor

I am having the same issue on my end. Hopefully someone from ESRI can respond soon!

0 Kudos
CarlosHenderson
New Contributor

Im receiving the same error when trying to Navigate to a point

0 Kudos