AnsweredAssumed Answered

Attribute Rule: What am I doing wrong?

Question asked by tpcolson Champion on Jan 16, 2020
Latest reply on Jan 16, 2020 by kelly.koenig

From arcade-expressions/CopyValueIntersectingFeature.md at master · Esri/arcade-expressions · GitHub , I have 

// This rule will populate the edited features field with a value from an intersecting feature

// Value to copy from the intersected feature
var intersecting_field = "GRTS_ID";
//Field rule is assigned to in the Attribute Rule
var feature_field = "GRTS_ID";

// Create feature set to the intersecting class using the GDB Name
var intersecting_featset = FeatureSetByName($datastore, 'NABAT_CONUS_10x10_KM_GRID_CELLS_PRJ', [intersecting_field], true);

// Intersect the edited feature with the feature set and retrieve the first feature
var intersected_feature = First(Intersects(intersecting_featset, $feature));

// Check to make sure there was an intersected feature, if not, return the original value
if (intersected_feature == null)
{
    return $feature[feature_field];
}
// If the intersected feature is null, return the original value
if (IsEmpty(intersected_feature.GRTS_ID))
{
    return $feature[feature_field];
}
// Return the intersected features value
return intersected_feature[intersecting_field];

and 

 

Where NABAT_CONUS_10x10_KM_GRID_CELLS_PRJ is a polygon feature class with the field GRTS_ID (Type Long) and the field I'm wanting to edit in the source feature class is also GRTS_ID (Type Long). 

 

What is happening though is on insert and update, the GRTS_ID field in the feature class being edit instead gets the ObjectID of the intersecting Polygon. 100% sure I've gotten something wrong here. 

Outcomes