Book a Demo

Author Topic: External Requirement  (Read 3258 times)

MoMo

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
External Requirement
« on: December 14, 2007, 02:38:02 pm »
Hello ,

 i have external element requirements, when i try to do something like this :
Code: [Select]

EA.Element oElem = Repository.GetElementByID(100);
foreach (EA.Requirement req in oElem.Requirements)
{
MessageBox.Show(req.Name);
}


it doesn't show the external requirements(but the others it does).

how can i access to those external element requirements ?

thanks

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: External Requirement
« Reply #1 on: December 14, 2007, 04:16:04 pm »
Hi MoMO,

This is not too difficult to solve.

I'm guessing a bit here, but...

[I'm not really guessing, but it has been quite a while since I played around with these, and I may have forgotten some of the details.]

External requirements are separate elements, and not properties of the element(s) they relate to. In fact, you can relate an external requirement to more than one element, or to none at all.

So, you cannot reach these things by enumerating the Requirements collection. That collection is designed to contain internal elements only, which is why you are getting the results you are.

So, you need to find out which external requirement elements are connected to your 'master' element. You can go about this a few ways. The most practical may be to step through the master element's connectors collection. If a given connector is of the appropriate type (and perhaps direction) you can obtain a reference to the element at the other end. If that element has a type of "Requirement" (the string is case sensitive) they you're in business.

HTH, David
No, you can't have it!

MoMo

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: External Requirement
« Reply #2 on: December 15, 2007, 05:31:03 am »
thanks David for your help. i have an other question.

  i add an element requirement by automation, Do you know if it's possible to move that element requirement to external by automation (like we do in the element propreties in EA)?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: External Requirement
« Reply #3 on: December 15, 2007, 06:59:39 am »
Sorry MoMo,

There is no direct call to do this. You'll have to go through the various steps explicitly. You need to create a new Requirement element, set up its properties as appropriate (probably copying from your internal requirement). Then you need to link the new element to the 'parent' element of your internal requirement. Finally, you need to clean up by removing the internal requirement.

It's actually not much work, once you get down to it.

David
No, you can't have it!