edwv's picture

For those who write reports and macro's it's not always easy to determine which objects, symbols and connections are used on a model. Here you find two small reports that can help you in determining that.

testSym

The first report which I call testSym is used to show some object and symbol information from occurrences on a model in a message box.

var nLocale = Context.getSelectedLanguage();

function main()
{
    
    var selmodel=ArisData.getSelectedModels()[0];
   
    var occlist=selmodel.ObjOccList();
    var x="";
    var filter=ArisData.ActiveFilter();
    for(i=0;i<occlist.length;i++)
    {
        var API=filter.getAPIName(Constants.CID_OBJOCC,occlist[i].getSymbol())
        x=x + 
          occlist[i].getObjDefName(nLocale) + " [" + occlist[i].ObjDef().Type() + 
          " / " + occlist[i].SymbolName() + " (" + occlist[i].getSymbol() + ") ], API-name = " + API + "\n" 
    }   
    Dialogs.MsgBox(x);     
}
main();

testCxn

The second report which I call testCxn is used to show some connection information from occurrences on a model in a message box. This one is very helpful (which doesn't make the previous one senseless) since often there are multiple connections with the same name, so which one is the correct one.

function main()
{
    
    var selmodel=ArisData.getSelectedModels()[0];
   
    var cxnocclist=selmodel.CxnOccList ( );
    var x="";
    var filter=ArisData.ActiveFilter()
    for(i=0;i<cxnocclist.length;i++)
    {
        var API=filter.getAPIName(Constants.CID_CXNDEF,cxnocclist[i].CxnDef().TypeNum())
        x=x + 
          cxnocclist[i].CxnDef().ActiveType() + " (" + cxnocclist[i].CxnDef().TypeNum()+ " - " + API + "): " + 
          cxnocclist[i].SourceObjOcc().ObjDef().Name(-1) + " (" + cxnocclist[i].SourceObjOcc().ObjDef().Type(false) + ") -> " + 
          cxnocclist[i].TargetObjOcc().ObjDef().Name(-1) + " (" + cxnocclist[i].TargetObjOcc().ObjDef().Type(false) + ")\n"
    }   
    Dialogs.MsgBox(x);     
}
main();

I hope these two small reports help you in developing your reports

 

Edwin

Tags: ARIS Report Scripting tutorial