Book a Demo

Author Topic: SQL to find classifier  (Read 6214 times)

Hurra

  • EA User
  • **
  • Posts: 183
  • Karma: +0/-0
    • View Profile
    • Find me at LinkedIn!
SQL to find classifier
« on: October 18, 2018, 06:51:13 pm »
Hello!

I don't really get why I don't get any results for this SQL-query...

Code: [Select]
select o.ea_guid as CLASSGUID, o.Object_Type as CLASSTYPE, o.Name
from t_object o, t_object o2
where o2.Object_ID = #OBJECTID#
and o.ea_guid = o2.Classifier_guid

If I change the and statement to
Code: [Select]
and o.Object_ID = o2.ParentID

I get the correct parent, but it doesn't work with classifier?

What am I missing? It's such a small and simple search  :-\

and what does o2.Classifier return? I googled and found:

Quote from: Inside Enterprise Architect by Thomas Kilian
NULL or 0 where not defined. If > 0 then it is the
    primary key of the element which classifies the element

Tried to use it as a returning object ID with no result.

Thanks!
always learning!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: SQL to find classifier
« Reply #1 on: October 18, 2018, 07:32:54 pm »
Classifier_id matches the object_id, not the GUID.

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: SQL to find classifier
« Reply #2 on: October 18, 2018, 07:39:32 pm »
When I run that positioned on an object it works and lists its classifier.

q.

Hurra

  • EA User
  • **
  • Posts: 183
  • Karma: +0/-0
    • View Profile
    • Find me at LinkedIn!
Re: SQL to find classifier
« Reply #3 on: October 18, 2018, 07:42:39 pm »
Classifier_id matches the object_id, not the GUID.

q.

What do you mean? .Classifier_ID doesn't event exist? Only .Classifier and .Classifier_guid, I tried using .Classifier as Object_ID
always learning!

Hurra

  • EA User
  • **
  • Posts: 183
  • Karma: +0/-0
    • View Profile
    • Find me at LinkedIn!
Re: SQL to find classifier
« Reply #4 on: October 18, 2018, 07:44:36 pm »
When I run that positioned on an object it works and lists its classifier.

q.

Well nothing happens for me. I have triple checked that the #OBJECTID# I use is an instance of an object, therefore it definitely should have an classifier? Looks like it on a diagram at least.
always learning!

Hurra

  • EA User
  • **
  • Posts: 183
  • Karma: +0/-0
    • View Profile
    • Find me at LinkedIn!
Re: SQL to find classifier
« Reply #5 on: October 18, 2018, 08:10:55 pm »
When I run that positioned on an object it works and lists its classifier.

q.

Well nothing happens for me. I have triple checked that the #OBJECTID# I use is an instance of an object, therefore it definitely should have an classifier? Looks like it on a diagram at least.

Ok, might have figured out the problem. They are properties. If I right click on the object I have "Locate Property Type", not "Locate Classifier".

always learning!

Hurra

  • EA User
  • **
  • Posts: 183
  • Karma: +0/-0
    • View Profile
    • Find me at LinkedIn!
Re: SQL to find classifier
« Reply #6 on: October 18, 2018, 08:22:11 pm »
Solved it like this:

Code: [Select]
select o.ea_guid as CLASSGUID, o.Object_Type as CLASSTYPE, o.Name as Classifier, o2.Name as Instance
from t_object o
inner join t_object o2 on o.ea_guid = o2.PDATA1
where o2.Object_ID = #OBJECTID#
always learning!