Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: aljazjelen on July 09, 2021, 10:52:35 pm

Title: ID of current diagram
Post by: aljazjelen on July 09, 2021, 10:52:35 pm
Hi everyone,

I would like to use a "Model View" object where you can write an sql query to show the results. With it, I want to show a content of each diagram (currently selected) and their dependencies.
But to do it properly, I would need to somehow find the ID of the diagram, which is currently being viewed (not neccessarly selected on the tree!).

Can someone help me with SQL, to somehow:

I am quite new to this, so if you have any additional learning material, I would appreciate it!

Regards :)
Title: Re: ID of current diagram
Post by: qwerty on July 09, 2021, 11:15:42 pm
I'm not sure if there's some (new) native #-macro to get the diagram in focus. Otherwise I think you need an add-in search to get hold of that. Manually you could Alternatively you could Alt-Shift-G to the browser entry and use Copy/GUID to get the diagram guid which you can also utilize for that query.

q.
Title: Re: ID of current diagram
Post by: aljazjelen on July 10, 2021, 12:07:49 am
Hi Q!

So most likely there is no other option. Of course, one option would be making document fragments and generating report as well.
But I would like to have it interactively.

The reason: We are having a very complicated system with many independencies. For this reason, we are building a system in modular manner. And would be great to have an overview of all dependencies within a function diagram.
Relationship Matrix is cool, but it lacks the possibility to "filter empty cells" :(

However, thanks for reply!
Title: Re: ID of current diagram
Post by: Geert Bellekens on July 10, 2021, 05:11:52 pm
You can find the list of available macro's here:

https://sparxsystems.com/enterprise_architect_user_guide/15.2/navigation/creating_filters.html (https://sparxsystems.com/enterprise_architect_user_guide/15.2/navigation/creating_filters.html)

But I'm not sure if all of those are useful in a modelview context.
We use modelviews on our BPMN diagrams to show a RASCI matrix between activities and roles.
We ended up simply putting the Business Process GUID in the query like this:

Code: [Select]
select bpa.ea_guid as CLASSGUID, bpa.Object_Type as CLASSTYPE, bpa.name as Activity,
r.RoleName
, CASE WHEN r.RASCI = 'R' THEN r.RASCI ELSE NULL END as R
, CASE WHEN r.RASCI = 'A' THEN r.RASCI ELSE NULL END as A
, CASE WHEN r.RASCI = 'S' THEN r.RASCI ELSE NULL END as S
, CASE WHEN r.RASCI = 'C' THEN r.RASCI ELSE NULL END as C
, CASE WHEN r.RASCI = 'I' THEN r.RASCI ELSE NULL END as I
from t_object bp
left join t_object pl on pl.ParentID = bp.Object_ID
and pl.Stereotype = 'Pool'
left join t_object ln on ln.ParentID in (pl.Object_ID, bp.Object_ID)
and ln.Stereotype = 'Lane'
inner join t_object bpa on bpa.ParentID in (ln.Object_ID, pl.Object_ID, bp.Object_ID)
and bpa.Stereotype = 'Activity'
left join t_objectproperties tv on tv.Object_ID = bpa.Object_ID
and tv.Property = 'calledActivityRef'
left join t_object ca on ca.ea_guid = tv.Value
left join
(select c.Start_Object_ID, ro.Name as RoleName, tv.VALUE as RASCI from t_connector c
inner join t_object ro on ro.Object_ID = c.End_Object_ID
and ro.Stereotype = 'PartnerRole'
left join t_connectortag tv on tv.ElementID = c.Connector_ID
and tv.Property = 'RA(S)CI'
where c.Stereotype = 'trace') r on r.Start_Object_ID = bpa.Object_ID
inner join t_diagram d on d.ParentID = bp.Object_ID
inner join t_diagramobjects do on do.Diagram_ID = d.Diagram_ID
and do.Object_ID = bpa.Object_ID
where bp.ea_guid = '{616040A4-201F-4fa9-9EDA-448597DDD9BA}'
order by do.RectLeft, do.RectTop desc, bpa.Name, CASE WHEN r.RASCI = 'R' THEN 1
WHEN r.RASCI = 'A' THEN 2
WHEN r.RASCI = 'S' THEN 3
WHEN r.RASCI = 'C' THEN 4
WHEN r.RASCI = 'I' THEN 5 END

Geert
Title: Re: ID of current diagram
Post by: aljazjelen on July 22, 2021, 06:38:19 pm
Hi Geert and qwerty!

I have approached the problem in a different way. Now I will manually chance the GUIDs where relevant (at the end, there are only about 7-8 diagrams)

Thanks for support :)