Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Wishmaster84 on June 13, 2022, 05:38:23 pm
-
Hi all,
I would like to create a custom template where to show some relationship matrixes. In particular, for some of them I have created overlays and I need to show the complete matrix on the template.
I have added the relationship matrix tag, showing both the name and the image ( {Matrix.Image}) but the overlay is not showed. Do you have any suggestion in how I can represent the complete matrix on the template?
Thanks
-
I don't think the way matrixes are exported is useful at all.
In most cases I get an image that is not readable, cannot be searched, etc...
What I usually do is write an SQL fragment that contains the same information as the matrix (albeit in a different format in a table with a fixed number of columns)
Something like this. This is used in a template that links BPMN activities to partner roles, with a RASCI overlay.
select bpa.name as Activity,
r.RoleName, r.RASCI
, 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
left join t_diagramobjects do on do.Object_ID = bpa.Object_ID
left join t_diagram d on d.Diagram_ID = do.Diagram_ID
and d.ParentID = bp.Object_ID
where bp.Object_ID = #OBJECTID#
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
This one we use to link BPMN activities to system components (without overlay)
select bpa.name as Activity, apc.Name as SystemName
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 aac.Start_Object_ID, apc.Object_ID, apc.Name
from t_connector aac
inner join t_object apc on apc.Object_ID = aac.End_Object_ID
and apc.Stereotype = 'EAM_ApplicationComponent'
where aac.Stereotype = 'trace') apc on apc.Start_Object_ID = bpa.Object_ID
left join t_diagramobjects do on do.Object_ID = bpa.Object_ID
left join t_diagram d on d.Diagram_ID = do.Diagram_ID
and d.ParentID = bp.Object_ID
where bp.Object_ID = #OBJECTID#
order by do.RectLeft, do.RectTop desc, bpa.Name, apc.Name
Geert
-
Thanks Geert,
This code is very helpful. How does the final results look like?
-
Thanks Geert,
This code is very helpful. How does the final results look like?
Like this (roles and system have not yet been filled in for this example) https://imgur.com/a/xjCE8AY (https://imgur.com/a/xjCE8AY)
Geert
-
Thanks,
In addition, I'm also evaluating to create a Document Script with JScript code to be more flexible in creating a table with variable rows and columns. Regarding this aspect, I'm trying to debugging the script (running Debug Script from the Scripting list) but I have an issue when it run this part of code:
Repository.GetElementByID(object);
The message the debugger gives is: Repository is undefined.
How is it possible to debug considering the Repository of the model ?
Thanks
-
Thanks,
In addition, I'm also evaluating to create a Document Script with JScript code to be more flexible in creating a table with variable rows and columns. Regarding this aspect, I'm trying to debugging the script (running Debug Script from the Scripting list) but I have an issue when it run this part of code:
Repository.GetElementByID(object);
The message the debugger gives is: Repository is undefined.
How is it possible to debug considering the Repository of the model ?
Thanks
Repository should always be available in the context. I'm not sure what you are doing wrong.
I just tested with this script, and it simply works when debugging.
!INC Local Scripts.EAConstants-JScript
function main()
{
Session.Output(Repository.ConnectionString);
var test = Repository.GetElementByID(222);
Session.Output(test.name);
}
main();
Geert
-
I'm still having the same message. I'm launching the debug directly from the scripting tab. Is it correct? The debug output is the following:
[11567396] Stack recording threshold set to 3 frames
[11567474] Default Directory is C:\Program Files\Sparx Systems\EA
[11567474] Agent dll found: C:\PROGRA~1\SPARXS~1\EA\SScript.dll
[11567474] Default Directory is C:\Program Files\Sparx Systems\EA
[11567475] Agent: Started
[11567495] Failed to get EA::IDualApp interface
[11567513] dbg.enabled=undefined
[11567514] vea.hit =function hit() {
[11567514] [native code]
[11567514] }
[11567514] compiling script for url: C:\Users\passem3\AppData\Local\Temp\2AE65E46-AE57-4116-AFEC-6D28746C27BC.js
[11567519] compiling script for url: C:\Users\passem3\AppData\Local\Temp\BE2A36AA-7250-412f-B0D0-D902B344325A.js
[11567519] Repository is undefined
-
Ah, maybe you need the windows script debugger tool to debug jscripts as well.
That shouldn't happen if you use JavaScript.
This component used to be available for download from Microsoft, but it has been removed from the website a few years ago.
I still have a copy on my google drive though: https://drive.google.com/file/d/0B5YX31GyMA64NUJsQnJiaVhLWlk/view?usp=sharing&resourcekey=0-hnwq41cEfiaQT9BTYW325Q (https://drive.google.com/file/d/0B5YX31GyMA64NUJsQnJiaVhLWlk/view?usp=sharing&resourcekey=0-hnwq41cEfiaQT9BTYW325Q)
Geert
-
Hi,
I'm able now to debug Javascript. As I mentioned in previous posts, my purpose is to create a table starting from a matrix I have already created in EA that connect states (source) with a set of actuators (modeled as blocks). The idea is to create a dynamic table, considering that both states and actuators numbers could change. Is it possible to do something like this with a Document Script or I need to create a table with a fixed number of rows and columns?
Thanks
MP
-
A dynamic number of columns is hard, and will be hard on the layout as well.
Pages have a fixed width, so if your table has lots of columns the columns will become very very narrow.
But if you really want to, you can indeed use a Document Script template.
IIRC you'll need to provide the raw RTF code in a script for this to work.
I've never done this myself, but it feels like a major challenge.
Putting the same info in a fixed column table is much much easier and can be done with a simple SQL fragment. (like 1 hour vs 3 days)
Geert