I have built a simple QuickCapture app that uses Arcade Expressions to calculate the Name of an area that the captured point is in based on a polygon layer.
The point layer is a hosted layer on Enterprise and the polygon layer is a referenced feature layer (editing disabled). They are shared with the same groups and I have created a map with both layers in it, that I am using in the QuickCapture Project.
I used the arcade expression from https://developers.arcgis.com/arcade/profiles/quick-capture/ to get started as I am doing pretty much the same thing.
When I test my arcade expression in the editor, I am getting the right result, but when I submit records from my phone the area is not populated - it just remains blank.
I tested just: return "Test" and it did populate Test.
I also tested just returning the Name of the First(Area) in the FeatureSetByName (without the intersect) and it also resulted in a blank. This makes me think it is not able to access the feature layer when doing the calculation. How can I further troubleshoot this?
I can see the polygon layer in the map in QuickCapture on my device.
Solved! Go to Solution.
Worked with Esri Support on this and they gave me a different version of the arcade script.
This is what they think the problem was:
"It looks like the issue stems from the HasValue function in the documentation’s sample script. The QuickCapture mobile app uses Arcade version 1.18, and HasValue was only introduced in version 1.20, along with the Quick Capture Arcade profile according to the documentation."
They are going to reach out to Esri Inc to get the documentation updated.
The code that ended up working in the end:
var regions = FeatureSetByName(
$map,
"Regions",
["Name"],
True
);
var intFs = Intersects(Geometry($feature), regions);
var region = First(intFs);
if (IsEmpty(region)) {
return "Other";
} else {
return region["Name"];
}
Worked with Esri Support on this and they gave me a different version of the arcade script.
This is what they think the problem was:
"It looks like the issue stems from the HasValue function in the documentation’s sample script. The QuickCapture mobile app uses Arcade version 1.18, and HasValue was only introduced in version 1.20, along with the Quick Capture Arcade profile according to the documentation."
They are going to reach out to Esri Inc to get the documentation updated.
The code that ended up working in the end:
var regions = FeatureSetByName(
$map,
"Regions",
["Name"],
True
);
var intFs = Intersects(Geometry($feature), regions);
var region = First(intFs);
if (IsEmpty(region)) {
return "Other";
} else {
return region["Name"];
}