Book a Demo

Author Topic: Add or change tag value for all elements in a package.  (Read 3022 times)

billay

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Add or change tag value for all elements in a package.
« on: September 16, 2019, 05:34:44 pm »
Hello Administrator,

I need to know how to change or add the tag value in a package with VB script. I would like to add the tag value to all the elements in a package recursively.

My main question would be if i run the script it should first get the package and then get the elements for eg. requirements/block and add the tagged value to all the elements in the package recursively. Since, i am new to VB, i am really struggling.

if somebody can help that would be great.


Thank you in advance
Billay

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Add or change tag value for all elements in a package.
« Reply #1 on: September 16, 2019, 05:41:55 pm »
Billay

The proper way would probably be to create a UML profile an add the tagged value as property to your own stereotype.

You can however also add the tagged value in a script. In the example scripts there is a script that runs through the model.

It basically get the package, gets the elements, then repeats for all subpackages.

An alternative (and much faster) approach is to get the elements you need with an SQL Query.

See https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library for a bunch of examples.

Geert

billay

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Add or change tag value for all elements in a package.
« Reply #2 on: September 16, 2019, 07:41:55 pm »
Hello Geert,

Thank you for reverting. I found a script which counts the elements in a package recursively. so the example script you are talking about is different than this one?
I am trying to add tagged values with script. do you have any specific example for that as well?.


Thank you very much

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller