Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Andrew Warner on February 16, 2010, 03:42:37 pm
-
Hi all,
I have made some significant changes to some tagged values I want to apply to standard stereotypes (GUIElement items with various stereotypes).
[edit]Oh, and there are lots of them so I don't want to do it manually![/edit]
The synchronize stereotype doesn't work for items not in my profile so I was going to do it in the script but two things happened...or didn't happen, as it happens.
Firstly, I can't figure out how to list the tagged value types for an MDG technology.
Secondly, even if I know its fully qualified tag name I can't seem to find a way to add it via the API in one of the supported scripting languages. I'm using JScript but that's not important.
I tried Element.TaggedValues.AddNew("tagname", "tagvalue"); but that didn't seem to update at all.
Over to you...
Cheers,
Andrew.
-
Hi Andrew,
Try:
TagName = "Fred"
TagValue = "a value of some kind"
Set UpsertElementStringTag = Element.TaggedValues.AddNew(TagName, "TaggedValue")
UpsertElementStringTag.Value = TagValue
UpsertElementStringTag.Update
(in VBA)
Don't ask why it works... I can't even remember where I got it from...
HTH,
Paolo
-
Thanks Paolo,
that worked nicely. As it turns out I made a preposterous error and it is, in fact, documented under the Collection object reference. It's not all that clear but it is there.
Cheers,
Andrew.
P.S. Now all I have to do is to find the list of tagged value types defined in my MDG technology...
-
Now all I have to do is to find the list of tagged value types defined in my MDG technology
I don't think there is an API method for this (unless they added it with the latest version). The only way I can think of is browsing the xml file defining the MDG technology (loading it into a DOM or reading it with an xml parser).