0

I have a model in Enterprise Architect and I need to import some relationships (of already existing elements) that I have in an Excel. I tried running a JScript but wasn't able to run it (haven't still figured out why).

How can I import a massive amount of relationship into my model?

Thanks in advance.


My Script is:

!INC Local Scripts.EAConstants-JScript

var connectorArray = new Array(
['{870632BA-154F-4564-AD51-C508C1A7E537}','{4B291196-7B4B-490b-B51D-04B9925CAA2A}','Dependency','','RME1']
);

function main()
{
 var source as EA.Element;
 var target as EA.Element;
 var connector as EA.Connector;
 var sourceGUID,targetGUID,type,stereotype,alias;
 for(var i = 0; i < connectorArray.length; i++) {
  sourceGUID = connectorArray[i][0];
  targetGUID = connectorArray[i][1];
  type = connectorArray[i][2];
  stereotype = connectorArray[i][3];
  alias = connectorArray[i][4];
  source = Repository.GetElementByGuid(sourceGUID);
  target = Repository.GetElementByGuid(targetGUID);
  Session.Output("Processing connector: " + alias);
  if(source != null && target != null) {
   connector = source.Connectors.AddNew("",type);
   if(stereotype != "") {
    connector.Stereotype = stereotype;
   }
   connector.SupplierID = target.ElementID;
   connector.Alias = alias;
   connector.Update();
  }
  source.Connectors.Refresh();
 }
 Session.Output("END OF SCRIPT");
}

main();

My errors are:

[423447640]      Hilo de registro de pila establecido para marcos 3
[423447879]      Default Directory is C:\Program Files (x86)\Sparx Systems\EA
[423447879]      Agent dll found: C:\Program Files (x86)\Sparx Systems\EA\vea\x86\SSScriptAgent32.DLL
[423447879]      Default Directory is C:\Program Files (x86)\Sparx Systems\EA
[423447879]      Agent: Started
[423447967]      Microsoft Process Debug Manager creation Failed: 0x80040154 
[423447967]      This is included as part of various Microsoft products.
[423447967]      Download the Microsoft Script Debugger to install it.
[423447967]      Failed to initialize JScript engine
[423447967]      Sesión de depuración terminada

Thanks again.

  • Provide your code and we might see the issue. This way your question is off-topic. Please read the help pages (top right question mark). – qwerty_so Sep 04 '18 at 08:09
  • Thanks for your answer @ThomasKilian, I didn't upload the code because I'm searching for other ways to upload the relationships beside scripting. Let me attach the code and errors I get: – isaac lopez Sep 05 '18 at 19:47
  • There's not build-in way to do that, Maybe you can use the code posted on Sparx' forum? If so, just post an answer. Your code looks suspicious. You're indexing connectorArray as 2-dimensional though it#s only a 1-dim array. – qwerty_so Sep 05 '18 at 20:07

2 Answers2

0

Well, may be I'm wrong, but you can see the error Download the Microsoft Script Debugger to install it. I guess, that you're trying to run the script "Debug" button instead of "Run script".

If you want to debug your scrtipt, you"ll must to install any Microsoft product that contains debagger. Microsoft Script Debugger.

Grigorio
  • 25
  • 4
0

FYI Did you try the Excel Import \ Export feature of Sparx Systems in MDG Office Integration .

You can create \ update \ Synchronise model elements, connectors and other details inside enterprise architect in a single click.

Dah Sra
  • 4,107
  • 3
  • 30
  • 69