Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: heba on March 10, 2015, 10:31:06 am

Title: Problem adding tagged values to stereotypes
Post by: heba on March 10, 2015, 10:31:06 am
Hi all,

I created a stereotype "MyReq" of a "Requirement" and added some tagged values.  This gives a new tab "MyReq" in the properties window with all the tagged values. Using the automation interface I'm also able to create new requirement objects  into the repository together with the tags.

Now if the requirement object already exists but without that tagged value I'll try to add this using

TaggedValues.AddNew("VALUE1", "MyReq");

This result in adding the tagged value to the "base class", to the "Tags" section but not the other existing tags defined by the stereotype. I also played around with the "type" parameter and used "Requirement::MyReq" and so on but always got the same result.

Does anyone knows what's going on here and what would be the correct call?

Many thanks
Heiko
Title: Re: Problem adding tagged values to stereotypes
Post by: qwerty on March 10, 2015, 08:46:45 pm
Instead of adding them manually you need to synchronize the missing stereotypes (depends on the EA version you use). MDG stereotypes have some voodoo in t_xref you can not easily create via the normal API tag addition. See Repository.SynchProfile in the help.

q.
Title: Re: Problem adding tagged values to stereotypes
Post by: Geert Bellekens on March 11, 2015, 09:47:41 pm
Instead of adding them manuall try
Code: [Select]
EA.Element.SynchTaggedValues ("MyProfile","MyRec")
That works specifically on your element, not on all elements that have that stereotype.

Geert
Title: Re: Problem adding tagged values to stereotypes
Post by: heba on March 12, 2015, 05:43:54 am
That helped, many thanks!

Seems that this function does most of the stereotype cleanup which I intended to do manually :-)

-Heiko
Title: Re: Problem adding tagged values to stereotypes
Post by: Svend Erik Nygaard on March 12, 2015, 09:54:53 pm
It seems to me, that I get the work done easier/better by doing it in the follwoning order (for each individual element:
1) clean up / transform tag names and values
2) EA.Element.SynchTaggedValues
... because the EA.Element.SynchTaggedValues  will attempt to find matching tags.