Book a Demo

Author Topic: I can't get the tagged values from a SQL query  (Read 9800 times)

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
I can't get the tagged values from a SQL query
« on: October 30, 2024, 02:23:05 am »
I have a template set up, but I would like the template to apply only to a certain stereotype in my model. I can set up a query and get all the stereotypes in the model just fine. However, how do I get the tagged values and the parent package of the classes that were found? I have something like this as a basis:

Code: [Select]
SELECT ea_guid AS CLASSGUID, t_object.Name as "the_name"
FROM t_object
WHERE t_object.Package_ID=#Package# and t_object.Stereotype='configuration item';

Right now I get the <<configuration item>>s I need however, the name of every package is printed out too. I only need the parent package of the <<configuration item>>s found. Also, I still need the tagged values. I have tagged values for each <<configuration item>> like PNR, Type, Vendor. My desired result is:

PNRNameTypeDescriptionVendor
ABC-123A-DriverDriverSome description for the driverACME
« Last Edit: October 30, 2024, 06:46:18 pm by mse »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: I can't get the tagged values from a SQL query
« Reply #1 on: October 30, 2024, 08:12:05 pm »
each t_package has a twin in t_object (they share the same ea_guid)
then join t_objectproperties for the tagged values

Geert

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
Re: I can't get the tagged values from a SQL query
« Reply #2 on: October 30, 2024, 11:51:56 pm »
I keep getting errors with the inner join. I can even take a snippet of SQL from elsehwere and i still get errors:

Code: [Select]
select t_object.ea_guid AS CLASSGUID,
t_object.Object_Type AS CLASSTYPE,
t_object.Name,
tv.Value AS TagName
FROM t_object (
LEFT OUTER JOIN t_objectproperties AS tv ON (t_object.Object_ID = tv.Object_ID AND tv.Property = 'Vendor'))

Native Open FAILED with error:
Token unknown - line 2, column 17
SQL error code = -104
Dynamic SQL Error
« Last Edit: October 31, 2024, 02:52:06 am by mse »

sjf

  • EA User
  • **
  • Posts: 35
  • Karma: +1/-0
    • View Profile
Re: I can't get the tagged values from a SQL query
« Reply #3 on: November 02, 2024, 03:07:01 am »
I believe that the problem is, is that you haven't named nested table, however I would simplify much more:

Code: [Select]
SELECT t_object.ea_guid AS CLASSGUID,
t_object.Object_Type AS CLASSTYPE,
t_object.Name,
tv.Value AS TagName
FROM t_object
LEFT OUTER JOIN t_objectproperties AS tv
  ON t_object.Object_ID = tv.Object_ID AND tv.Property = 'Vendor'

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: I can't get the tagged values from a SQL query
« Reply #4 on: November 02, 2024, 03:14:02 am »
There is a syntax error in your SQL:

t_objectproperties AS tv
Should be
t_objectproperties tv

Geert