Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - JacekSalamandra

Pages: [1]
1
Automation Interface, Add-Ins and Tools / Re: EA crashes
« on: September 18, 2015, 06:26:36 pm »
I've decided to change engine and use JavaScript instead JScript.
I need search parsing methods.
There are JScript methods XMLParseXML and XMLGetNodeTextArray but they not working in JavaScript.
new DOMParser() also is not working. I am stuck.

2
Automation Interface, Add-Ins and Tools / Re: EA crashes
« on: September 17, 2015, 07:48:02 pm »
Are there any logs in EA to see what's happened before crashing?

3
Automation Interface, Add-Ins and Tools / EA crashes
« on: September 17, 2015, 05:58:08 pm »
When i execute my script (java script). EA crashes. Is there any log file or something i could use to find out what was the reason od EA crash?

4
Automation Interface, Add-Ins and Tools / Re: Hierarchy in Project Browser
« on: September 02, 2015, 06:13:22 pm »
Yess ! That's work.
Code: [Select]
function getPackageByName(nazwa){
            var sql;
            var tablica as EA.Collection;
            sql="select * from t_object where Name=\""+nazwa+"\"and Object_Type=\"Package\" ";
            tablica=Repository.GetElementSet(sql,2);
            jedenElement("object",tablica);
            return GetPackageByGUID(tablica.GetAt(0).ElementGUID);
            }
Thank you very much.

5
Automation Interface, Add-Ins and Tools / Re: Hierarchy in Project Browser
« on: September 02, 2015, 05:34:36 pm »
Code: [Select]
function getPackageByName(nazwa){
            var  obj as EA.Element;
            var sql;
            var tablica as EA.Collection;
            sql="select * from t_object where Name=\""+nazwa+"\"and Object_Type=\"Package\" ";
            tablica=Repository.GetElementSet(sql,2);
            jedenElement("object",tablica); // throws error when tablica!=1
            Session.Output("table length"+ tablica.Count);
            Session.Output("pack name"+ tablica.GetAt(0).Name);
            return tablica.GetAt(0);
            }
Code: [Select]
function createDiagram(pakiet,diagramName){
            var diag as EA.Element;
            diag = pakiet.Diagrams.AddNew(diagramName, "Activity");
            diag.Update();
       }
Code: [Select]
createDiagram(getPackageByName("pakiet"),"examp");
I am sure there is one pakiet package.




6
Automation Interface, Add-Ins and Tools / Re: Hierarchy in Project Browser
« on: September 02, 2015, 05:12:38 pm »
The diagram is creates always on the same level at the same level as package "pakiet". I wolud like create diagram under "pakiet" package, not at the same level.
I ve changed "pakiet"package location but the effect is still the same.

7
Automation Interface, Add-Ins and Tools / Hierarchy in Project Browser
« on: September 01, 2015, 09:56:47 pm »
Hi,
I try to create an empty diagram under  package using script
Code: [Select]
function createDiagram(pakiet,diagramName){
            var diag as EA.Element;
            diag = pakiet.Diagrams.AddNew(diagramName, "Activity");
            diag.Update();
       }
The diagram is created but when i loot at Project Browser i see the new diagram is under root node, not under my package.
Please help.


8
Thanks for your help :)

9
Hi.
Is it possible to get list of connectors via SQL and assign it to Array in JScript?
I try use
Code: [Select]
var flw = new Array();
sql="SELECT Name FROM t_connector where styleEx<>\"\"";
flw=Repository.GetElementSet(sql,2) ;
but I get DAO.Fields[3265] Item not found in this collection error.

10
Thank you for your answers. Finally, I used the following script. It is slow but can quite simple to understand and maintain.
Quote
!INC Local Scripts.EAConstants-JScript

/*
 * Script Name:
 * Author: JacekSalamandra
 * Purpose:
 * Date:
 */
 
 function isInArray(ar,value){
 for (var k=0;k<ar.length;k++){
       if (ar[k]==value) return true;
       }
       return false;
       }

function main()
{      
      // start=Date();
      // Session.Output("Start "+start ) ;
      Session.Output("Connector_ID;Type;Direction;Source;Target;Notes;ConveyedItemsCount;ConveyedItem"); // Headers
      var tablica = [];
      var elements as EA.Collection ;
      sql="SELECT * FROM t_object where "
      +" Object_ID in (select Start_Object_Id from t_connector where Connector_Type in ('InformationFlow') ) "
      +" OR "
      +" Object_ID in (select End_Object_Id from t_connector where Connector_Type in ('InformationFlow') ) "
      elements=Repository.GetElementSet(sql,2) ;

      for (var i=0; i<elements.Count; i++) {
            for (var j=0; j<elements.GetAt(i).Connectors.Count; j++) {
                  connectorID = elements.GetAt(i).Connectors.GetAt(j).ConnectorID;
                  if ( (elements.GetAt(i).Connectors.GetAt(j).Type=="InformationFlow") && (isInArray(tablica,connectorID)==false ) ){
                        sqlSuppiler= "SELECT Object_ID,Name FROM t_object where Object_ID=" + elements.GetAt(i).Connectors.GetAt(j).SupplierID;
                        sqlClient="SELECT Object_ID,Name FROM t_object where Object_ID=" + elements.GetAt(i).Connectors.GetAt(j).ClientID;
                        type = elements.GetAt(i).Connectors.GetAt(j).Type;
                        direction = elements.GetAt(i).Connectors.GetAt(j).Direction;
                        source = Repository.GetElementSet(sqlClient,2).GetAt(0).Name;
                        target = Repository.GetElementSet(sqlSuppiler,2).GetAt(0).Name;
                        notes = elements.GetAt(i).Connectors.GetAt(j).Notes;
                        conveyedItemsCount = elements.GetAt(i).Connectors.GetAt(j).ConveyedItems.Count;                                    
                        if (elements.GetAt(i).Connectors.GetAt(j).ConveyedItems.Count==0)      {
                              Session.Output(connectorID +";"+type +";"+direction +";"+source +";"+target+";"+notes+";"+conveyedItemsCount);
                              tablica.push(connectorID);
                        }
                              else {
                                    for (var k=0; k<elements.GetAt(i).Connectors.GetAt(j).ConveyedItems.Count;k++)      {
                                    Session.Output(connectorID +";"+type +";"+direction +";"+source +";"+target+";"+notes+";"+conveyedItemsCount+";"+elements.GetAt(i).Connectors.GetAt(j).ConveyedItems.GetAt(k).Name);
                                    tablica.push(connectorID);                                          
                                    }                                    
                              }
                  }
            }
      }
      end=Date();
      // Session.Output("Table size "+tablica.length);
      // Session.Output("End "+ end + "(start:"+start+" )" ) ;
}
main();

11
Is there any simple (I mean witout iteration) way to get a collection of all connectors in a particular package (and subpackages)  from script?
My packages have subpackages, they have own subpackages and so on.

12
Thanks for your replies.
Quote
substring(x.description,0,39),
 substring(xCon.description,39,39)
Shouldn't be only xCon or x in all rows in IN() block?

What if conveyed items is more than e.g.20?
SQL statement return only first 10 items.

VB script seems return all items.

My aim is to create rerport with column Source"."Destination","InformationItemConveyed (DataObject)" for all InformationFlow in selected Package.

13
How can i retreive all “Information Items Convedyed” for selected “InformationFlow”? I use "Find in project" sql editor feature.

Pages: [1]