Book a Demo

Author Topic: Connector through the Automation Interface  (Read 4991 times)

Yves.

  • EA Novice
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Connector through the Automation Interface
« on: August 17, 2010, 01:09:24 am »
Hi there,

I'm trying to add a Connector between two Elements from JScript. I am using this piece of code

var myConnector as EA.Connector;
myConnector = myPackage.Connectors.addNew("myCon", "Association");
myPackage.Connectors.Refresh();
myConnector.Update();

...where myPackage is a suitably initialized package.

When trying to update, the JScript engine complains that myConnector is null. My understanding is that it should be created by Connectors.addNew(...). Any clue?

Thanks,
Yves.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Connector through the Automation Interface
« Reply #1 on: August 17, 2010, 09:53:02 am »
Hi Yves,

How did you attach the connector to its ends?  ;)

You need to setup the connector before you update it and in the following order...

                oConnector.Update();
                oPackage.Connectors.Refresh();
                oPackage.Update();

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: Connector through the Automation Interface
« Reply #2 on: August 17, 2010, 12:15:09 pm »
Y'all,

Check this post : http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1281541624/4#4 and see if this is of any help...
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.


beginner

  • Guest
Re: Connector through the Automation Interface
« Reply #3 on: August 17, 2010, 08:11:33 pm »
The code obviously lacks .SupplierID / .ClientID to be supplied (one of both is filled automatically but the other needs to be added by hand).

b.

Yves.

  • EA Novice
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Re: Connector through the Automation Interface
« Reply #4 on: August 20, 2010, 12:51:09 am »
Thanks to all,

Please see my post to Fred in the "Bugs and Issues" forum.

Yves.