Hello folks,
I am trying to sort a list of connections occurrences of a object, by the NAME of the occurrence of the target object. But I could not figure it out by myself how to do.
I have a piece of code of what I am doing:
var aCxn = p_aObjOcc.Cxns()
for(var k=0; k<aCxn.length; k++) {
obj = aCxn[k].TargetObjOcc();
var aCxn2 = obj.Cxns()
aCxn2 = ArisData.sort( aCxn2, Constants.AT_NAME, Context.getSelectedLanguage() )}
But this is not working. I know I should change the parameter Constants.AT_NAME to something that would order by the name of the occurrences of the target objects, but I dont know how to.
Any tip about how I should solve this is very very much appreciated.
Thank you very much,
Gustavo
Florian Rese on
Hi Gustavo,
as per the ARIS script help the command TargetObjOcc() is depreceated and instead the command getTarget() is recommended to be used.
Also you want to sort an array of object occurrences by an attribute, whereas the attribute values are only stored in the definition of an object as per my understanding. Maybe you need to retrieve the definition corresponding to each of the occurrences of the target object and then sort this list by the name attribute or as a shortcut use getObjDefName(int p_nLocale) which returns the "Name" attribute from the definition of this occurrence.
Hope this is of any help.
Cheers
Florian