Dear community, good day!
I have encountered an unknown error when using the Neighbour() method. Here's the issue: I have two arrays with instances of objects, functionArr and rolesArr. I want to check if there is a connection between each object from the arrays. I am using the following code (example):
for (var i=0;i<SubModelObj.functionsOccs.length;i++){
for(j=0;j<SubModelObj.rolesOccs.length;j++){
Dialogs.MsgBox(SubModelObj.modelInstance.Neighbour(SubModelObj.functionsOccs[i],SubModelObj.rolesOccs[j]).getDefinition().TypeNum());
}
}
The inner loop only runs once, displaying the relationship type number, and then throws an error "An error occurred while executing the script: An error has occurred in the report object model. Cannot save modified objects in read-only mode.".
What could be causing this error and how can I resolve it?
Hello Anton,
the scripting help (/abs/help/en/script/ba/#/home/r_O_Model_neighbour/en/1) reads like a warning here:
The return value, i.e. the relationship between the two object occurrences, possibly an invalid object, if both nodes in the graph are not contiguous (check results!).
So if your two arrays are filled randomly with function and role occurences there is a high probability they are not neighbours. I doubt this is an efficient evaluation, but I do not know what you are aiming at.
Regards, Martin