Book a Demo

Author Topic: Trace between elements  (Read 3598 times)

Bojan Knezovic

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Trace between elements
« on: November 17, 2010, 06:52:09 am »
Hi,

Is it possible to start (using VBScript) with one EA.Element and list all other elements that it is linked to? For example I'd like to start with a Requirement and list all use and test cases that are linked to it in any way. It would be awesome for traceability purposes..

I could list all elements in a package but I am having a hard time navigating through Collections (actually I don't know which collections exist at all) and identifying the correct element types. And I can't find any reference either.. so, any help is appreciated.  ;)

Thanks.
« Last Edit: November 17, 2010, 06:52:29 am by bojank »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Trace between elements
« Reply #1 on: November 17, 2010, 08:13:44 am »

Bojan Knezovic

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Trace between elements
« Reply #2 on: November 17, 2010, 08:19:52 am »
Yeah, I've been just looking into it but I can't see any GUID or something that I could later use to search for the other element...

http://www.sparxsystems.com/enterprise_architect_user_guide/8.0/automation_and_scripts/connector.html

Code: [Select]
for each currentElement in currentPackage.Elements
..
if (currentElement.Type = "UseCase") then
..
for each elem in currentElement.Connectors

..and now what?  :-?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Trace between elements
« Reply #3 on: November 17, 2010, 05:20:14 pm »
Bojan,

I think it should be more like this:
Code: [Select]
foreach (EA.Connector con in currentElement.Connectors)
{
    EA.Element linkedElement;
    if (con.SupplierID != currentElement.ElementID)
    {
           linkedElement = myRepository.GetElementByID(con.SupplierID);
     }
    else
    {
          linkedElement = myRepository.GetElementByID(con.ClientID);
     }
}

Geert

PS. This is C# syntax, you'll have to translate that to VBScript syntax.
« Last Edit: November 17, 2010, 05:21:08 pm by Geert.Bellekens »