A requested row object could not be located-Attribute rule for calculating and update value on relationshipclass.

274
3
05-14-2024 08:25 AM
anilkumar
New Contributor II

Hello all- I am working to set up our attribute rules. I would like to create a rule that will copy edited row of a feature class to another feature class when there is a status change from Attribute values.  am following this error based on code provided in the forum: EW is relationshipclass maintaining parent GLOBALID(as CGUID) and comparing anc evaluating new lstatus

 

var globalId = $feature.globalid
var lstatus = $feature.LSTATUS;
var tableToUpdate = "EW";
var returnField1 = "GLOBALID";
var returnField2 = "globalid"
var fs = FeatureSetByName($datastore, "EW", [returnField1, returnField2], false);
var feats = Filter(fs,'CGUID = @globalId');
if(feats == null || Count(feats) == 0) {
return $feature.comments;
}
else{
for(var feat in feats){
var updateDict = {'GlobalID': feat.globalid, 'attributes': {}};
updateDict['attributes'] ['lstatus'] = lstatus;
var updateList = [updateDict];
var editDict = {'className': tableToUpdate, 'updates': updateList};
var editList = [editDict];
var returnDict = {'edit': editList};
return returnDict;
}
}
return $feature.comments;

 

I am getting an error "

Update table row : EL
update table row failed.
A requested row object could not be located.
Rule Name : AR23
Triggering Event Update

ClassName: EL,
GlobalID :{XX--xx}"

0 Kudos
3 Replies
HusseinNasser2
Esri Contributor

The error essentially say you tried to update a feature that doesn't exist. So we need to debug to see what the rule is passing.. 

I see you are using 2.9.10, is it possible to move to 2.9.12?  we included many fixes for attribute rules and relationships there plus we also included the ability to print the console output to the debug diagnostics in Pro. 

 

I included the updated rule with few changes.. 

Run the rule while ArcGIS Pro monitor is running (debug mode) (CTRL+ALT+M), and look for the console output , I added **** to make searching easy, see what output you get, this will tell us more. 

 

var globalId = $feature.globalid
var lstatus = $feature.LSTATUS;
var tableToUpdate = "EW"; 

var fs = FeatureSetByName($datastore, "EW", ["globalid"], false);
var feats = Filter(fs,'CGUID = @globalId');


var editDict = {'className': tableToUpdate, 'updates': []};

var updateCount = 0;
var updateList = [];

for(var feat in feats)
{
    var updateDict = {'GlobalID': feat.globalid, 'attributes': {"lstatus": lstatus}};
    updateList[updateCount++] = updateDict
 }
//if no matches simply return. 
if (updateCount == 0) $feature.comments;

editDict[updates] = updateList;
//print out 
console("******" + text(editDict))
return {'edit': editList};
 

 

 

0 Kudos
anilkumar
New Contributor II

Thank you for the details.

anilkumar_0-1715721018279.png

currently am receiving an error message 'object not found updates' . As per your code, not wanting to update GLOBALID( here in child (relationship class ) which is CGUID. CGUID is mtaching with Parent GlobalID already. Only need to update lstatus as updated the records related to parent.

 

0 Kudos
anilkumar
New Contributor II

Thank you for the inputs. I am unable to proceed with versions other than the current one. However, after testing, I found that the provided code does not produce any errors or the desired results. I have made the following updates. Could you please review? Additionally, note that CGUID is a child table field being compared with the parent feature’s globalid. I want to update the ‘LSTATUS’ attribute of the child feature (EW) to match the value of the parent asset’s LSTATUS when a user updates it.

var globalId = $feature.GLOBALID
var lstatus = $feature.LSTATUS;
var tableToUpdate = "EW"; 

var returnField1 = "CGUID";
var returnField2 = "GLOBALID"

var fs = FeatureSetByName($datastore, "EW", [returnField1], false);
var feats = Filter(fs,'CGUID = @globalId'); 

if(feats == null) {
return $feature.LSTATUS;
}
else{
     for(var feat in feats){
         var updateDict = {'GlobalID': feat.CGUID, 'attributes': {}};
         updateDict['attributes'] ['lstatus'] = lStatus;
         var updateList = [updateDict];
         var editDict = {'className': tableToUpdate, 'updates': updateList};
         var editList = [editDict];
         var returnDict = {'edit': editList};  
         return returnDict; 
     }
}
return $feature.LSTATUS;

 

0 Kudos