Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started 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
-
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.
-
Instead of adding them manuall try
EA.Element.SynchTaggedValues ("MyProfile","MyRec")
That works specifically on your element, not on all elements that have that stereotype.
Geert
-
That helped, many thanks!
Seems that this function does most of the stereotype cleanup which I intended to do manually :-)
-Heiko
-
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.