Book a Demo

Author Topic: Documenting enumerations under respective attributes  (Read 3849 times)

Evandro

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Documenting enumerations under respective attributes
« on: September 11, 2018, 08:22:00 pm »
Hi,
I'm building a document template and I'd like an enumeration element referred to a certain class' attribute to be reported just below that particular attribute.
I know enumerations are elements themselves, that's why default Model Report template lists all the enumerations after all my classes.
Any idea how to achieve this?

Thanks,
E.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Documenting enumerations under respective attributes
« Reply #1 on: September 11, 2018, 09:02:25 pm »
I once created an SQL fragment for exactly this purpose.

Geert

Evandro

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Documenting enumerations under respective attributes
« Reply #2 on: September 11, 2018, 10:59:16 pm »
Ok, does it mean not achievable through EA template editor only?
I saw your tool for model generation (thanks), but I guess my problem is more on the template side. Am I wrong?
Thanks

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Documenting enumerations under respective attributes
« Reply #3 on: September 12, 2018, 02:54:06 am »
Ok, does it mean not achievable through EA template editor only?
I saw your tool for model generation (thanks), but I guess my problem is more on the template side. Am I wrong?
Thanks
Yes, I think so.
Once you reach the attribute level you cannot go back up, or include info from another element (such as the enumeration)

This is the query I use to output the attribute info into a table. This is tailored to a UMM type data model with «BDT» elements and a «CON» attribute that has an «ENUM» as type.
For a regular data model that would be simpler.

Code: [Select]
select att.[Pos] AS Pos, att.[Name],
isnull(tv.Value,'') +
case when tv.Value is not null and att.Notes is not null then char(13)+char(10) ELSE '' END
+ convert(varchar(max),isnull(att.Notes,'')) AS [Description-Formatted], att.LowerBound, att.UpperBound ,
case WHEN enum.Object_ID is not null THEN
isnull(o_enum.Name, enum.Name) + ':' +
(SELECT char(10) + ev.Name + ' (' + cd.VALUE + ')'  AS [text()]
FROM t_attribute ev
inner join t_attributetag cd on cd.ElementID = ev.ID
and cd.Property = 'Codename'
WHERE ev.Object_ID = enum.Object_ID
ORDER BY ev.Pos
FOR XML PATH (''))
 ELSE att.TYPE end AS Format
from t_attribute att
left join t_attributetag tv on att.ID = tv.ElementID
and tv.Property = 'definition'
left join t_object bdt on att.Classifier = bdt.Object_ID
left join t_attribute con on con.Object_ID = bdt.Object_ID
  and con.Stereotype = 'CON'
left join t_object enum on con.Classifier = enum.Object_ID
and enum.Object_Type = 'Enumeration'
left join t_connector et on et.Start_Object_ID = enum.Object_ID
and et.Connector_Type = 'Abstraction'
and et.Stereotype = 'trace'
left join t_object o_enum on o_enum.Object_ID = et.End_Object_ID
and o_enum.Object_Type = 'Enumeration'
where att.Object_ID = #OBJECTID#
union all
select 0, 'N/A', 'This Entity has no attributes' AS [Description-Formatted], '', '',
'' AS Format
where not exists
(select a.ID from t_attribute a where a.Object_ID = #OBJECTID#)
order by Pos

Geert