Author Topic: RTF attribute / method ID  (Read 681 times)

royvanmarrewijk

  • EA User
  • **
  • Posts: 61
  • Karma: +1/-0
    • View Profile
RTF attribute / method ID
« on: January 26, 2022, 07:27:42 pm »
Hi,
For a document template I would like to show the attribute and method ID. I tried to show this bij using a custom fragment but I can't get the correct input variable for this. To get the object id I have to use #OBJECTID# but this doesn't apply for attributes in a way like #ATTRIBUTEID# or #ID#. Can someone tell me how to show the attribute and if there is some kind of reference document where to find this kind information?

Roy

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11723
  • Karma: +454/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RTF attribute / method ID
« Reply #1 on: January 26, 2022, 08:07:58 pm »
You can't use template fragments on the level of an attribute.

The solution I use is to create a fragment for all attributes of an element.
Usually that is an SQL fragment where I produce a list of all attributes, and the properties I need from them (name, notes, tagged values, multiplicity, etc...)

Here's an example of the SQL query we use for attributes in our Logical Data Model:

Code: [Select]
select att.[Pos] AS Pos, att.[Name]
, CASE WHEN att.Derived = 1 THEN '<b>Derived</b>' + CHAR(10) + att.Notes
ELSE att.Notes END 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] in ('Company::Data Classification', '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

Geert

royvanmarrewijk

  • EA User
  • **
  • Posts: 61
  • Karma: +1/-0
    • View Profile
Re: RTF attribute / method ID
« Reply #2 on: January 27, 2022, 06:05:32 pm »
Thanks Geert, this is working well!