Book a Demo

Author Topic: Using element.RequirementsEx  (Read 4320 times)

ALL_IN_ONE

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Using element.RequirementsEx
« on: November 10, 2009, 03:44:11 pm »
Dear all,

I am currently facing the problem of external requirments mapped to the component element. I am using a addin to iterate over the RequirementsEx of the element of type "Component". But the EA Api element.RequirementsEx doesnt recognize the external requirement elements mapped from the "Require" tab of the Component type ELement. I believe its the API problem; . . .

can anybody help in this?

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Using element.RequirementsEx
« Reply #1 on: November 10, 2009, 04:24:17 pm »
My understanding is that the Requirements and RequirementsEx collections are only for internal requirements.  External requirements need to be discovered via the Connectors collection.

ALL_IN_ONE

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: Using element.RequirementsEx
« Reply #2 on: November 11, 2009, 04:41:05 pm »
hi,

i hope you have understood what I am trying to say? I dont know how connectores collection are related to the External requirements shown in the Require tab of the component element properties.
Do you have any sample code snipppet to read these external requirements from the component element properties?

regards,

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Using element.RequirementsEx
« Reply #3 on: November 11, 2009, 05:05:05 pm »
An external requirement is linked to your context element via a Realisation connector.  To find these requirements, you will need to find all "Requirement" elements, linked to your context element by a "Realisation" connector.  The following is an example of how to do this in VBScript.

Code: [Select]
Sub ListExternalRequirements(element)
      Dim i, con, target
      
      For i = 0 To element.Connectors.Count - 1
            Set con = element.Connectors.GetAt(i)
            If con.Type = "Realisation" Then
                  Set target = GetElementByID(con.SupplierID)
                  If target.Type = "Requirement" Then
                        Session.Output "Requirement: " & target.Name
                  End If
            End If
      Next
End Sub

ALL_IN_ONE

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: Using element.RequirementsEx
« Reply #4 on: November 13, 2009, 09:59:57 pm »
thanx a million it works fine . . .