Unable to pass a Filter Feature Set through Intersects?

275
0
07-26-2021 07:26 AM
Labels (2)
RDSpire
New Contributor

I'm setting up an attribute rule to pick a field from the first nearby feature and automatically enter it into a field on the target feature class. However, I want to add a  Filter to the nearby feature class so it will only pull from feature classes with a certain query.

I'm using the below code for it. However, I get a "General evaluation error" when trying to pass the filter into the Intersects code. I'm not sure why it won't take a filtered feature set as the Filter should be outputting a featureset object?

 

//Calculation Rule
//Populate the edited feature's Street Address with a value from the Service FC

//Triggers:  Insert

// Value to copy from the intersected feature
var intersecting_field = 'MXLOCATION';

//Field rule is assigned to in the Attribute Rule
var feature_field = 'MAINMXLOCATION';

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

// Filter feature set by active main only (test with Material steel)
var main_filter = Filter(polylineFC, "MXDISPLAY = Y");

// Buffer function for intersect
var featBuf = Buffer($Feature, 5, "meters");

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

// Check to make sure there was an intersected feature, if not, return the original value
if (intersected_feature == null)
{
    return $feature.MAINMXLOCATION;
}

// If the intersected feature is null, return the original value
if (IsEmpty(intersected_feature[intersecting_field]))
{
    return $feature[feature_field];
}

// Return the intersected features value
return intersected_feature[intersecting_field];

 

 

 

Tags (3)
0 Kudos
0 Replies