Book a Demo

Author Topic: Getting the linked item  (Read 4947 times)

Ibrahim

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Getting the linked item
« on: June 27, 2008, 08:48:46 am »
I am having hard time to get the elements related links

I have Requirments1 element linked to Use Case1 and Use Case2. I dont see any APIs in VB Add in to get the related links.

Please help me...........

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Getting the linked item
« Reply #1 on: June 27, 2008, 08:53:30 am »
You want Element.Connectors which is a collection of EA.Connector.

Ibrahim

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Getting the linked item
« Reply #2 on: June 27, 2008, 12:28:37 pm »
I did the same but I am not able to get the related item. Do you have any sample code for the same?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Getting the linked item
« Reply #3 on: June 27, 2008, 02:44:37 pm »
No. I just got the information you needed out of the help file.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Getting the linked item
« Reply #4 on: June 27, 2008, 03:32:10 pm »
Ibrahim,

1) First, you need a reference to the Element you are interested in.
2) Loop over the Element.Connectors collection
3) Check the Connector.ClientID and Connector.SupplierID values.  These are ElementID values for the objects at each end of the connector.  One of these will refer back to your first element, and the other will refer to the related element.
4) With the ElementID obtained above, use Repository.GetElementById() to retrieve a reference to the related element.

Dermot

  • EA Administrator
  • EA User
  • *****
  • Posts: 591
  • Karma: +7/-0
    • View Profile
Re: Getting the linked item
« Reply #5 on: June 27, 2008, 03:40:18 pm »
In the VB code available from the download page on:
http://www.sparxsystems.com/resources/developers/autint_vb.html
There are a couple routines dealing with this. See Repository.bas - DumpConnections, as well as, RequirementMain.bas - DumpHeirarchy.  These give two different routines of displaying Element- connector relations.