Hello,
I have issues when trying to return a field from an intersecting polygon on points features. For some features it returns a result and for some others not. Here is my code :
// Value to copy from the intersected feature
var intersecting_field = "NAME";
// check existing value
var old_concession = $feature.CONCESSI;
if (isEmpty(old_concession) || old_concession == Null) {
// Create feature set to the intersecting class using the GDB Name
var intersecting_featset = FeatureSetByName($datastore, 'main.CONSESSION', [intersecting_field], true);
var intersected_feature = First(Intersects(intersecting_featset, $feature))
//console(intersected_feature.NAME)
// Check to make sure there was an intersected feature, if not, return the original value
if (IsEmpty(intersected_feature) || intersected_feature == null){
return;
}
// If the intersected feature is null, return the original value
if (IsEmpty(intersected_feature.name))
{
return;
}
var result = {
//result is a dictionary
"result": {
"attributes": {
"CONCESSI": intersected_feature[intersecting_field]
}
}
};
return result
}
I noted that including the geometry or not in the featureSet does not change the result, but I understand that this is a known bug, resolved in 3.2.
The polygons represent cities, so may have a large geometry.
Tested in ArcGIS Pro 3.1 in a UN mobile geodatabase, in popups and in an attribute rule.
[EDIT] I tried to debug, and found that count(intersected_feature) = 1. But even in this case, intersected_feature[intersecting_field] returns nothing...