Book a Demo

Author Topic: Access to Object Heading of Tagged Values  (Read 3676 times)

dagraf

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Access to Object Heading of Tagged Values
« on: August 11, 2008, 09:51:55 pm »
Hi,

I'd like to get access from an Add-In to the Object Heading of the Tagged Values of an element of Type "Requirement". Does somebody know if this is possible?  :o

Thanks for your help  :)
Daniel

dagraf

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Access to Object Heading of Tagged Values
« Reply #1 on: August 12, 2008, 05:57:36 pm »
With the following code line it is possible to get the Object Heading:

Code: [Select]
object obj = element.TaggedValues.GetByName("Object Heading");
But the only return value is an object. How can I get the Object Heading as a String?

If I try it with
Code: [Select]
obj.toString() the result is always "System.__ComObject".  :-/


dagraf

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Access to Object Heading of Tagged Values
« Reply #2 on: August 12, 2008, 09:26:43 pm »
Sometimes it needs a few hours and every problem is soved....  ;)

Code: [Select]
object obj = element.TaggedValues.GetByName("Object Heading");
EA.TaggedValue tv = (EA.TaggedValue)obj;
string str = tv.Value;


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Access to Object Heading of Tagged Values
« Reply #3 on: August 12, 2008, 10:42:02 pm »
Yes, now that you've explained what you want I can see the situation.

What you were retrieving is the tagged value (i.e. the UML entity) itself, not its value. You have to explicitly query the object's properties to get the name and value components.

You're now doing it correctly.

Note that you might - I have not checked this for tagged values - encounter problems if the element has more than one tagged value with the same name. [Depending on your settings this could be possible.] You likely could only retrieve the first such tagged value this way. If you need them all you would have to enumerate the collection (via an index) and inspect each one.

David
No, you can't have it!