Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: rupertkiwi on December 05, 2022, 01:38:16 pm

Title: Recursive VB script to list elements and their children
Post by: rupertkiwi on December 05, 2022, 01:38:16 pm
Hi,

Does anyone have a VB script handy to list elements in a package and the element's children?

thanks
Title: Re: Recursive VB script to list elements and their children
Post by: Eve on December 05, 2022, 03:37:15 pm
You do.

Open the scripting window.
Expand the "Local Scripts"
The script you want is called "VBScript - Recursive Model Dump Example".
Title: Re: Recursive VB script to list elements and their children
Post by: Geert Bellekens on December 05, 2022, 03:56:39 pm
If you find that slow, there's a faster alternative using SQL:

https://sparxsystems.com/forums/smf/index.php/topic,38987.msg259113.html#msg259113 (https://sparxsystems.com/forums/smf/index.php/topic,38987.msg259113.html#msg259113)

Geert
Title: Re: Recursive VB script to list elements and their children
Post by: rupertkiwi on December 05, 2022, 04:17:36 pm
Thanks Geert.

I have been using that recursive script and it works well for a single level of element but I also want to get the elements that are nested under other elements, I'm having a bit of trouble with it.

Rupert
Title: Re: Recursive VB script to list elements and their children
Post by: Geert Bellekens on December 05, 2022, 05:59:50 pm
Rupert,

The idea of the SQL Query method is to call that one recursively untill you have all the ID's of all nested elements.

That is definitely the fastest way to get the elements.

Geert