Book a Demo

Author Topic: Issue editing TaggedValuesEx in Attribute class  (Read 3708 times)

rjsmith

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Issue editing TaggedValuesEx in Attribute class
« on: March 11, 2010, 05:15:55 am »
Hi,
  I'm working on an Add-In for EA written in C#.  I'm using EA version 7.5.849 and Visual Studio 2008.  I'm trying to create elements in a package with data stored as attributes.  The attributes are classified to another class element that I created which defines a series of tagged values.  When I try to edit the tags for the individual attributes, the Attribute.TaggedValues collection is empty - all the tags show up under Attribute.TaggedValuesEx.  When I change the value in the TaggedValuesEx, it changes the tag value in the parent, rather than "moving" the tag from the TaggedValuesEx to TaggedValues, as is the behavior if I do the same operation through the GUI.  The result is that the tags get set for the parent, rather than for the attribute itself.
I've searched the forum and looked through the help with no luck.  Could someone please help me understand what is the proper method for modifying "inherited" tags in an object, rather than modifying the parent's tag values?

Code snippets provided upon request.
Thanks!
Rebecca

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Issue editing TaggedValuesEx in Attribute clas
« Reply #1 on: March 11, 2010, 03:57:24 pm »
Rebecca,

If you are editing a tagged value from the taggedValuesEx collection that isn't in the TaggedValues collection then you are actually editing the tagged value defined on the parent.

You cannot expect the operations on the API to do exactly what you do on the GUI. I'm guessing that if you start editing a parent tagged value in the GUI it will create a copy of that tagged value on the child element.

You can do the same using the API.

Use Element.TaggedValues.AddNew() to add a new tagged value to the element, using the same name as the parent tagged value, and then change the value of this new tagged value.

Geert

rjsmith

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Issue editing TaggedValuesEx in Attribute clas
« Reply #2 on: March 12, 2010, 06:30:06 am »
Disregard - upon further investigation, looks like when I create an AttributeTag with a name that matches a TaggedValue in the TaggedValueEx, it removes the attr from the TaggedValueEx list.
Thanks!

Geert,
  I suspected that this was the case.  Given this approach, in the GUI, when a tag is edited, it moves from the TaggedValuesEx list to teh TaggedValues list.  If I use the approach you mentioned (creating a new AttributeTag in the TaggedValues collection), should I delete the corresponding attribute from the TaggedValuesEx, or with this delete the attribute from the parent?

Thanks!
Rebecca
« Last Edit: March 12, 2010, 08:24:44 am by rjsmith3 »

Andrzejb

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Issue editing TaggedValuesEx in Attribute clas
« Reply #3 on: April 02, 2010, 11:42:22 pm »
Hi,
My requirement is to add and import from external source extra local description/definitions  to UML componnent/system objects (say couple of hundred)
Is there any tool add in helping do this ?
Regards
Andrzej
Poland

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller