Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: Erik Forsling on September 15, 2025, 05:57:24 pm

Title: Dependencies between packages
Post by: Erik Forsling on September 15, 2025, 05:57:24 pm
Hi,
I working within a large organization, where we have many models and packages which are shared, and thus managed on corporate level. When working with a "local" package I find myself constantly worrying about accidently changing something that I shouldn't. I'm not sure if this is a feature request, or if there is actually a way to find all objects referenced in my diagrams which are not part of my packages, if you get what I mean. Surely there should at least be a way to build such a search/query?
Title: Re: Dependencies between packages
Post by: Geert Bellekens on September 15, 2025, 06:25:58 pm
A search is pretty easy to make

Code: [Select]
select o.* from t_object o
inner join t_diagramobjects dod on dod.Object_ID = o.Object_ID
inner join t_diagram d on d.Diagram_ID = dod.Diagram_ID
where d.Package_ID in (#Branch#)
and not o.Package_ID in (#Branch#)

Geert
Title: Re: Dependencies between packages
Post by: Erik Forsling on September 15, 2025, 06:43:25 pm
Thanks!
I will experiment with this on some of my use cases!
From the looks of it (I know some SQL but I'm not to familiar with the schema in EA) this will cover one specific package. Would it be possible to cover a whole package structure in the same manner, recursively? Maybe that would require to first form a list of all package-IDs in a structure, and put in #Branch#).

Oh, that yields another question. Which version of (MS?) SQL is in EA? Is it able to process Common Table Expressions (CTEs)?
Title: Re: Dependencies between packages
Post by: Geert Bellekens on September 15, 2025, 07:01:36 pm
Thanks!
I will experiment with this on some of my use cases!
From the looks of it (I know some SQL but I'm not to familiar with the schema in EA) this will cover one specific package. Would it be possible to cover a whole package structure in the same manner, recursively? Maybe that would require to first form a list of all package-IDs in a structure, and put in #Branch#).

Oh, that yields another question. Which version of (MS?) SQL is in EA? Is it able to process Common Table Expressions (CTEs)?
That's what the #Branch# macro does for you. It will be replaced by EA by the package ID of the selected package, and all packages in that branch in a comma separated list.
This avoids the need for CTE's

This query returns all objects that are from a different branch, but used on a diagram in this branch.

Geert
Title: Re: Dependencies between packages
Post by: Erik Forsling on September 15, 2025, 11:15:27 pm
Wow. You just made my day. I had no idea that existed. Need to dive into query building I guess. This is super handy. Thank you so much.
Title: Re: Dependencies between packages
Post by: Geert Bellekens on September 15, 2025, 11:37:30 pm
On this page you'll find the documentation of all supported macro's

https://sparxsystems.com/enterprise_architect_user_guide/17.1/the_application_desktop/creating_filters.html (https://sparxsystems.com/enterprise_architect_user_guide/17.1/the_application_desktop/creating_filters.html)

Geert
Title: Re: Dependencies between packages
Post by: Elpis on September 16, 2025, 12:52:31 am
That's what the #Branch# macro does for you. It will be replaced by EA by the package ID of the selected package, and all packages in that branch in a comma separated list.

But EA documentation, you mentioned in later post, says: "[...] gets the ID of each child Package of the parent Package selected by the user". If I read it correctly, it means, child packages (recursively) only, without the selected parent package itself... I didn't check whether the documentation is right or wrong, though. (Or I am wrong with interpretation of it.)
Title: Re: Dependencies between packages
Post by: Geert Bellekens on September 16, 2025, 03:09:28 pm
That's what the #Branch# macro does for you. It will be replaced by EA by the package ID of the selected package, and all packages in that branch in a comma separated list.

But EA documentation, you mentioned in later post, says: "[...] gets the ID of each child Package of the parent Package selected by the user". If I read it correctly, it means, child packages (recursively) only, without the selected parent package itself... I didn't check whether the documentation is right or wrong, though. (Or I am wrong with interpretation of it.)
Regardless of what the documentation says, it includes the selected package as well.

Geert