Book a Demo

Author Topic: ObjectType.otRequirement  (Read 4287 times)

cem

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
ObjectType.otRequirement
« on: October 30, 2008, 08:08:32 am »
Hi,

I'm trying to access requirement elements  (created via Custom Toolbox) in a package. When I try:

foreach (EA.Element element in package.Elements)
{
                if (element.ObjectType == EA.ObjectType.otRequirement)
                {
                    // some code...
                }
 }

I can't get any requirement since all elements have object type otElement. Although I see Requirements while debugging, their object types are otElement, not otRequirement.

I can't figure out what is wrong and can't find another way to reach to the requirements. Do you have any idea?

Thank you...

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: ObjectType.otRequirement
« Reply #1 on: October 30, 2008, 08:33:17 am »
Yes, all elements have the type of otElement, because that's what type of class they are.  You would only get otRequirement when iterating through element.Requirements.

Look at element.Type == "Requirement" instead.

cem

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: ObjectType.otRequirement
« Reply #2 on: October 30, 2008, 04:06:19 pm »
Ok, it works. Thank you so much.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: ObjectType.otRequirement
« Reply #3 on: October 30, 2008, 10:26:06 pm »
Note that the Type attribute is case sensitive. The list of acceptable values, with correct case, is in the API documentation for the attribute.

[One guess who keeps getting caught by this...]
No, you can't have it!