Author Topic: Adding a Tag to all elements in a package  (Read 6089 times)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1098
  • Karma: +28/-8
    • View Profile
Adding a Tag to all elements in a package
« on: February 14, 2025, 05:14:24 am »
I am sure this has been covered before in this forum but cannot find a relevant post.

Does anybody have a script to add a tag to all elements of a certain type in package?

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1098
  • Karma: +28/-8
    • View Profile
Re: Adding a Tag to all elements in a package
« Reply #1 on: February 14, 2025, 10:32:53 pm »
Having looked at this in more detail, for this type of element, a database table, Sparx EA does not add a tag, it creates an object property.

From a scripting point of view, is this the same as adding a tag?

M1TO

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: Adding a Tag to all elements in a package
« Reply #2 on: February 14, 2025, 10:38:47 pm »
Well, you have to find the elements you want to add the tagged value to by finding all elements in the selected package. And then you can use the EaScriptLib functions TVGetElementTaggedValue and TVSetElementTaggedValue from JScript-TaggedValue.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13303
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Adding a Tag to all elements in a package
« Reply #3 on: February 15, 2025, 02:59:02 am »
Having looked at this in more detail, for this type of element, a database table, Sparx EA does not add a tag, it creates an object property.

From a scripting point of view, is this the same as adding a tag?
Yes, a part of the object properties are tagged values.

The script would be very basic

  • Loop all elements
  • for each element loop tagged values to see if the tagged value already exists
  • if it doesn't exist, add a new tagged value
  • if it does exist set the value
  • update the tag
  • next element

Geert
[/list]


Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1098
  • Karma: +28/-8
    • View Profile
Re: Adding a Tag to all elements in a package
« Reply #4 on: February 18, 2025, 11:23:24 pm »
Thank you Geert, will give it a try when available.