ARIS Community - We Love BPM

getParentObjOcc() question

scotty595's picture
by Scott Waddell in Reports & Macros posted on 2017-04-25

Hi All,

I'm trying to understand ARIS script a little more, I've been looking through the Script help file and have come across:

getParentObjOcc()

According to the help this is: "Objects in objects: Returns the object in which this object occurrence is contained."

I'm trying to understand how a object gets "contained" within another? I've imported some visio diagrams, and I've created a simple report to try and automatically create connections based on the objects contained in another object. 

The code so far is as follows:

  var objects = ArisData.getSelectedObjOccs();
 for(var i=0; i<objects.length; i++ )
 {
        objects[i].ObjDef().CreateCxnDef(objects[i].getParentObjOcc().ObjDef(), 283) 
 }

 

The issue I have is that it works on some of the diagrams which I have previously played around with, but on the freshly imported models it doesn't return an ObjDef from getParentObjOcc().

Any ideas?

5054 Views
0 Likes
1 Comments
Sorry there are no tags
There are no attachments
Robert Goldenbaum posted on 2017-04-25

Hi Scott,

the parent obj occ is used for this object in object-thing. But basically, this is just an object, that has an implicit connection to its contained objects. The connection is there on definition level, but you cannot see it in the model. Only when you move the child object outside of the parent object will the connection be displayed.

So in your source code, you are trying to create a connection of the child to the parent. But if it already has a parent, you will already have a connection. If not, then you won't get the parent. This explains why it works on existing models (there you already have those connections), but not on new models (where the visio import just places two objects above each other without creating a connection).

So if you want to create those connections in your imported models, you would have to check which objects are laid above the others. You can do this only via the X/Y position and width/height of the occs...

BR Robert