Author Topic: Add MDG tech tagged value to an element in script  (Read 2643 times)

Andrew Warner

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Add MDG tech tagged value to an element in script
« 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.
« Last Edit: February 16, 2010, 03:46:18 pm by adwarner »
Regards,
Andrew Warner.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8598
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Add MDG tech tagged value to an element in scr
« Reply #1 on: February 16, 2010, 04:34:00 pm »
Hi Andrew,

Try:
Code: [Select]
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
« Last Edit: February 16, 2010, 04:35:01 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Andrew Warner

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Re: Add MDG tech tagged value to an element in scr
« Reply #2 on: February 17, 2010, 12:23:52 pm »
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...
Regards,
Andrew Warner.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Add MDG tech tagged value to an element in scr
« Reply #3 on: February 17, 2010, 05:44:15 pm »
Quote
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).