Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: lynch80516 on February 29, 2020, 12:03:28 pm

Title: SQL Query Issue
Post by: lynch80516 on February 29, 2020, 12:03:28 pm
I have a query that I use to gather up attributes. The query is below.

select obj.Object_ID, obj.Name as Obj_Name, att.Name, att.Type, att. as 'Value'
, tv1.VALUE as Tag1, tv2.VALUE as Tag2
, att.Notes as Notes
From t_object obj, t_attribute att
left join t_attributetag tv1 on att.ID= tv1.ElementID
                     and tv1.Property = 'Unit of Measure'
left join t_attributetag tv2 on att.ID = tv2.ElementID
                     and tv2.Property = 'MsgColumn'
inner join t_object on  att.Object_ID = t_object.Object_ID   
where att.Object_ID = obj.Object_ID

This query works but searches the entire model, if I substitute #OBJECTID# for obj.Object_ID in the last line the query fails with Invalid Column #OBJECTID#

Has anyone seen this before and found a solution.

John
Title: Re: SQL Query Issue
Post by: Geert Bellekens on February 29, 2020, 05:18:07 pm
John,

Where are you using this query? In a search or in a template.

Templates work with #OBJECTID#, but searches don't.
In SQL Searches you can use macro's such as #CurrentElementID#

Geert