I am encountering an issue with saving an attribute rule in ArcGIS Pro

211
2
2 weeks ago
JuneAcosta
Occasional Contributor III

I have written an attribute rule in Arcade for a feature layer in ArcGIS Pro. The script validates. However, when I attempt to save the attribute rule, I encounter an error message and the rule fails to save. The error message I receive is as follows: error 999999 something unexpected cause the tool to fail when saving attribute rule.

This script gets the endpoint of the current line featureclass, then determines which point feature layers is connected to the end of the line. Then it grabs a value of the connected point feature and calcs it to the line feature. 

I'm reaching out to the community for any insights, advice, or troubleshooting tips to help resolve this issue. If anyone has encountered a similar problem or has suggestions for troubleshooting steps, I'd greatly appreciate your input.

Thanks a lot for your help!

// Define function to find intersecting point
function findIntersectingPoint(point, layerName) {
var fields = ['unitid'];
var layer_fs = FeatureSetByName($datastore, layerName, fields, true);
if (IsEmpty(layer_fs)) return null;
return First(Intersects(point, layer_fs));
}

// Main logic
var result = {};
var attributes = {};

// Get the end point of the line
var line_shape = Geometry($feature);
var spRef = line_shape['spatialReference'];
var end_x = line_shape['paths'][-1][-1].x;
var end_y = line_shape['paths'][-1][-1].y;
var end_point = Point({x: end_x, y: end_y, spatialReference: spRef});

// Define layers to check
var layersToCheck = [
"xxx.xxx.wwNetworkStructure",
"xxx.xxx.wwPump",
"xxx.xxx.wwSystemValve",
"xxx.xxx.wwManhole",
"xxx.xxx.wwFitting",
"xxx.xxx.wwCleanout"
];

// Flag to track if a connected layer has been found
var connectedLayerFound = false;

// Check which layer is connected to the end point of the line
for (var i in layersToCheck) {
var intx = findIntersectingPoint(end_point, layersToCheck[i]);
if (!IsEmpty(intx)) {
attributes['UNITID2'] = intx['UNITID'];
connectedLayerFound = true;
break;
}
}

// Check if attributes is not empty
if (connectedLayerFound) {
result = {
'attributes': attributes
};
}

//console(result)
return result;

 

0 Kudos
2 Replies
JonathanMcD
New Contributor III

Not even going to look at the script, but for starters, if I remember correctly - check that you have GlobalIDs enabled in the feature class. Rules and such like need globals to report.

Of course, given it's 2:30am here, I could be wrong 🙂

0 Kudos
HusseinNasser2
Esri Contributor
0 Kudos