0

I am using ArcGIS Pro 3.2.1 and working with an Arcade expression to update a parent layer when new inspections are performed in the related table.

I have tried a 1:M relationship class with GlobalIDs, GlobalID to GUID, and ObjectID to Object ID (original way table was related). When I select a point and attempt to add a row to the related table, the parent table is not updated. I get no errors.

var parent_id = $feature.parentglobalid ;
parent_id = Upper(parent_id);


var parent_class = FeatureSetByName($datastore, "hydrantCopy", ["GlobalID", 'class'], false);
var parent_records = Filter(parent_class, "GlobalID = @parent_id");

var updates = [];
var i = 0;
var new_value = '';

if ($feature.GPM >= 1500) {
new_value = "Blue - 1500 GPM or Greater";
}
else if ($feature.GPM >= 1000) {
new_value = "Green - 1000-1499 GPM";
}
else if ($feature.GPM >= 500){
new_value = "Orange - 500-999 GPM";
}
else {
new_value = "Red - 0-499 GPM";
}

 

for (var row in parent_records) {
// If the parent row is null or has a different value, updated it
if (IsEmpty(row['class']) || row['class'] != new_value)
{
updates[i++] = {
'GlobalID': parent_id,
'attributes': {"class": new_value}
};
}
}


return {
'result': parent_id,
'edit': [
{'className': 'hydrantCopy',
'updates': updates
}
]
};```
0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.