Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Modesto Vega on July 01, 2019, 07:46:38 pm
-
When using the template editor, the selection highlighted in bold below is allowed; when applied to a package it enumerates all the elements used by the diagrams contained in the package irrespective of whether they are physically in the package or not, but it does not enumerate their attributes.
Is it possible to enumerate the attributes without having to use the selection highlighted in italics?
Before somebody starts pontificating, please consider the implications: if a diagram reuses elements in another package, as far as I know
- the selection highlighted in italics would not enumerate any reused elements outside the package
- the selection highlighted in bold would enumerate any reused elements but will not enumerate their attributes of methods
Model
Package
---->Package Element
---->Diagram
-------->Element
-------->Connector
-------->Messages
-------->Audit History
---->Element
-------->....
-------->Attribute
-
I think a Sparxian once posted a weird workaround that made this possible.
Personally I tend to use SQL Fragments for attributes, so I don't really have this issue.
Geert
-
I think a Sparxian once posted a weird workaround that made this possible.
Personally I tend to use SQL Fragments for attributes, so I don't really have this issue.
Geert
Thanks Geert, could you please elaborate how you do this?
I am having an interesting fight with fragments.
-
Here an example fragment for attributes.
They are shown in a table
custom >
Attributes
Attribute name Description M ID T V DC Datatype
{Name} {Description.Formatted} {LowerBound}..{UpperBound} {IsID} {TimeSliced} {Versioned} {DataClassification} {Format}
< custom
With query:
select att.[Pos] AS Pos, att.[Name], att.Notes AS [Description-Formatted], att.LowerBound, att.UpperBound ,
CASE WHEN x.[Description] is null THEN 'no' ELSE 'yes' END AS IsID,
isnull(v.[Value], 'TBD') AS Versioned,isnull(dc.VALUE,'TBD') as DataClassification, isnull(ts.[Value], 'TBD') AS Timesliced, att.TYPE AS Format
from ((((t_attribute att
left outer join [t_attributetag] v on (v.[ElementID] = att.[ID]
and v.[Property] = 'Versioned'))
left outer join [t_attributetag] ts on (ts.[ElementID] = att.[ID]
and ts.[Property] = 'Timesliced'))
left outer join [t_attributetag] dc on (dc.[ElementID] = att.[ID]
and dc.[Property] = 'Atrias::Data Classification'))
left outer join t_xref x on (x.[Client] = att.[ea_guid]
and x.Type = 'attribute property'
and x.[Description] like '%@PROP=@NAME=isID@ENDNAME;@TYPE=Boolean@ENDTYPE;@VALU=1@ENDVALU;%'))
where att.Object_ID = #OBJECTID#
union all
select 0, 'N/A', 'This class has no specific attributes' AS [Description-Formatted], '', '',
'' AS IsID,
'' AS Versioned,'' as DataClassification, '' AS Timesliced, '' AS Format
where not exists
(select a.ID from t_attribute a where a.Object_ID = #OBJECTID#)
order by Pos
I'm not sure however if fragments in a Diagram>Element> section work.
If I need to report on elements shown on a diagram I usually write a script that creates model documents for each of the elements, so I usually only use the Package>Element section.
Geert
-
You are right, Sparx EA doesn't pass the DiagramID and for Diagram/Element (which I presume is different form Package/Element) it doesn't not allow to put a Fragment inside the element enumeration.
However, there is a workaround. The Package ID is passed and your query can be extended to just include the elements referenced by the diagrams in the package. It is not exactly the way I wanted to do this but I does the job.
select
att.pos AS Pos
,obj.Name AS ObjectName
,att.Name AttributeName
,att.Notes AS Description_Formatted
,att.LowerBound
,att.UpperBound
,CASE WHEN x.Description is null THEN 'no' ELSE 'yes' END AS IsID
,COALESCE(v.Value, 'TBD') AS Versioned
,COALESCE(dc.VALUE,'TBD') as DataClassification
,COALESCE(ts.Value, 'TBD') AS Timesliced
,att.TYPE AS Format
from t_attribute att
left outer join t_attributetag v on (v.ElementID = att.ID
and v.Property = 'Versioned')
left outer join t_attributetag ts on (ts.ElementID = att.ID
and ts.Property = 'Timesliced')
left outer join t_attributetag dc on (dc.ElementID = att.ID
and dc.Property = 'Atrias::Data Classification')
left outer join t_xref x on (x.client = att.ea_guid
and x.Type = 'attribute property'
and x.Description like '%@PROP=@NAME=isID@ENDNAME;@TYPE=Boolean@ENDTYPE;@VALU=1@ENDVALU;%')
left outer join t_object obj
on obj.object_id = att.object_id
left outer join t_diagramobjects dobj
on att.object_id = dobj.object_id
left outer join t_diagram d
on dobj.diagram_id = d.diagram_id
where d.package_id = #PACKAGEID#
group by att.pos, obj.Name,att.Name, att.Notes, att.LowerBound, att.UpperBound, x.Description, v.Value, dc.VALUE, ts.Value, att.TYPE
union all
select 0, 'N/A', 'N/A', 'This class has no specific attributes' AS Description_Formatted, '', '',
'' AS IsID,
'' AS Versioned,'' as DataClassification, '' AS Timesliced, '' AS Format
where not exists
(select att2.ID from t_attribute att2
inner join public.t_diagramobjects dobj2
on att2.object_id = dobj2.object_id
inner join public.t_diagram d2
on dobj2.diagram_id = d2.diagram_id
where d2.package_id= #PACKAGEID#
)
order by ObjectName, Pos