英文:
How to export a relationship matrix in a document?
问题
我正在寻找一种在生成的文档中导出关系矩阵的好方法。
EA提供的解决方案是将其导出为图像,但一旦矩阵包含许多行,它将看起来非常糟糕。
到目前为止,我使用的解决方法是:1)将矩阵导出到CSV,2)使用Office宏文件将CSV转换为Word中的表格,3)稍微重新格式化该表格,然后手动粘贴到导出的设计文档中。这相当繁琐。
我期望的是,也许我们需要运行脚本来实现这一点,它可以集成在整个EA文档导出中,自动编写正确的列名、行,并标记具有连接的单元格。
英文:
I'm looking for a good way of exporting a relationship matrix in a generated document.
The solution that EA gives is to export it as an image but that will look very bad as soon as the matrix contains many rows.
The workaround that I have used so far was to 1) Export the matrix to CVS, 2) Convert the CVS, with a Office Macro file, to a table in Word, 3) To reformat that table a bit and manually paste it into the exported Design document. This is quite cumbersome.
What I would expect, and maybe we need to run scripts for it, is something integrated in the overall EA export of the document, writing automatically the right column names, rows, and marking the cells with a connection.
答案1
得分: 1
你不能真正地做到这一点,除非使用文档脚本模板,并自己创建RTF代码。
矩阵的主要问题在于它们具有可变数量的列。标准的EA模板只适用于固定数量的列。
矩阵布局
角色1 | 角色2 | |
---|---|---|
活动1 | R | A |
活动2 | I |
下一个最好的方法是在固定列表格中呈现相同的信息。
固定列布局
活动 | 角色 | R | A | S | C | I |
---|---|---|---|---|---|---|
活动1 | 角色1 | R | ||||
活动1 | 角色2 | A | ||||
活动2 | 角色1 | I |
这种布局的主要优势是宽度可预测。使用矩阵布局时,列的数量通常太多,无法适应页面(并保持可读性)。
您可以使用SQL片段获取表格中的信息。
以下是一个示例查询,显示了BPMN图中的活动以及与BPMN合作伙伴角色的RASCI关系。
select bpa.name as 活动,
r.RoleName as 角色, 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
在这种情况下,这是一个左连接的情况。我们显示所有活动,甚至那些没有关联角色的活动,但只显示与活动关联的角色。
在EA中,我们使用关系矩阵(带有RASCI覆盖)来管理这些信息,但在文档中我们以这种方式显示它。
英文:
You can't really, or not without using a document script template, and creating the RTF code yourself.
The main problem with matrices is that they have a variable number of columns. Standard EA templates only work with a fixed number of columns.
Matrix layout
Role1 | Role2 | |
---|---|---|
Activity 1 | R | A |
Activity 2 | I |
The next best thing is to present the same information in a fixed column table.
Fixed column layout
Activity | Role | R | A | S | C | I |
---|---|---|---|---|---|---|
Activity 1 | Role 1 | R | ||||
Activity 1 | Role 2 | A | ||||
Activity 2 | Role 1 | I |
Major advantage of this layout is that the width is predictable. With a matrix layout the number of columns quite often is simply too much to fit on the page.(and remain readable)
You can use an SQL fragment to get the information in the table.
Here's an example of such a query that show the activities in a BPMN diagram and the RASCI relation to the BPMN PartnerRoles
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
In this case it's a left join situation. We show all Activities, even the ones that don't have a linked role, but we only show the roles linked to an Activity.
In EA we manage this information with a Relationship matrix (with RASCI overlay), but in the document we show it like this.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论