Book a Demo

Author Topic: How to Copy Tags between Elements?  (Read 3192 times)

vladap

  • EA User
  • **
  • Posts: 79
  • Karma: +0/-0
    • View Profile
How to Copy Tags between Elements?
« on: October 17, 2023, 10:15:27 pm »
Hello Guys,

I was wondering if there is a way how to copy Tag Values between elements.

e.g. I have 10 devices in Diagram, where I want to track CPU / Memory / OS ....

There is only few differences between the devices, which I would change later . Can I somehow copy this set of tag values to each device ?

thanks

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to Copy Tags between Elements?
« Reply #1 on: October 17, 2023, 10:47:20 pm »
I think you can only do that easily using a script:

Snippet from https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Framework/Utils/Util.vbs

Code: [Select]
'copies the tagged values from the source to the target
function copyTaggedValues(source, target)
dim sourceTag as EA.TaggedValue
dim targetTag as EA.TaggedValue
for each sourceTag in source.TaggedValues
set targetTag = nothing
'first try to find target tag
dim tag as EA.TaggedValue
for each tag in target.TaggedValues
if tag.Name = sourceTag.Name then
set targetTag = tag
exit for
end if
next
'if not found then create new
if targetTag is nothing then
set targetTag = target.TaggedValues.AddNew(sourceTag.Name,"TaggedValue")
end if
'set value
if not targetTag is nothing then
targetTag.Value = sourceTag.Value
targetTag.Notes = sourceTag.Notes
targetTag.Update
target.Update
end if
next
end function

Geert

vladap

  • EA User
  • **
  • Posts: 79
  • Karma: +0/-0
    • View Profile
Re: How to Copy Tags between Elements?
« Reply #2 on: October 19, 2023, 01:18:53 am »
ok thanks, I will use the script then