Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: lynch80516 on February 29, 2020, 06:08:59 pm
-
I have a number of elements and each element has a number of attributes and each attribute has a number of tagged values
I currently use a query that extracts the attributes and tagged values into tables where each attribute is a row in the table. This approach causes tables to be repeated with most of the same info
What I’d like to be able to do is use the tagged values properties as the table columns and have the values of the tags along with the attribute names as the rows.
Is this possible
John
-
Yes, simply join t_attributeTag multiple times, set the join property to a fixed value in the join condition.
select att.Name, att.Type, att.[Default] as 'Value'
, tv1.VALUE as Tag1, tv2.VALUE as Tag2
, att.Notes as Notes
From t_attribute att
left join t_attributetag tv1 on att.ID= tv1.ElementID
and tv1.Property = 'Tag1'
left join t_attributetag tv2 on att.ID = tv2.ElementID
and tv2.Property = 'Tag2'
inner join t_object on att.Object_ID = t_object.Object_ID
where att.Object_ID = #OBJECTID#
Geert