Book a Demo

Author Topic: SqlQuery'ing t_taggedvalue  (Read 5027 times)

blawton

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
SqlQuery'ing t_taggedvalue
« on: May 27, 2011, 06:14:00 am »
I'm trying to get a taggedvalue from a couple thousand requirements, which becomes cumbersome pretty quickly when I have to build the elements and parse through EA.Collection structures. I'm trying to use SQLQuery to get directly to the tagged values with something like:

Code: [Select]
"SELECT TagValue FROM t_taggedvalue WHERE ElementID  = <<requirement_element_id>>;"
 Suffice to say this doesn't work. Even when I do a general query like
Code: [Select]
"SELECT * FROM t_taggedvalue;"  I only get a few hundred results. Given that there are a few thousand requirements which all have 10+ taggedvalues associated with them this can't be right, so what am I doing wrong? When I rebuild the tags like so:

Code: [Select]
EA.Element currReq = (EA.Element)Repository.GetElementByID(objID);
EA.Collection tags = (currReq.TaggedValues);
EA.TaggedValue tag = (EA.TaggedValue)tags.GetByName("Status");

I get all the information I need, so I know the information is stored in a taggedValue, I must just be doing something wrong. Any tips for doing this by query?
« Last Edit: May 27, 2011, 06:15:20 am by blawton »

stao

  • EA User
  • **
  • Posts: 137
  • Karma: +0/-0
    • View Profile
Re: SqlQuery'ing t_taggedvalue
« Reply #1 on: May 27, 2011, 08:48:39 am »
try this to get all taggedValues in the repository:
"select * FROM t_objectproperties" for EA.Elements and
"select * FROM t_connectortag" for EA.Connectors


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: SqlQuery'ing t_taggedvalue
« Reply #2 on: May 27, 2011, 04:08:37 pm »
To complete that:
- t_attributetag for the attributes tagged values
- t_operationtag for the operations tagged values

t_taggedvalue seems to contain "the rest" of the tagged values. The elementID needs to be interpreted depending on the BaseClass.
If it's ASSOCIATION_SOURCE or ASSOCIATION_TARGET then you need to join t_connector on t_connector.ea_guid = t_taggedvalue.ElementID
if its PACKAGE you need to join t_package on ea_guid.

Geert

blawton

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: SqlQuery'ing t_taggedvalue
« Reply #3 on: May 28, 2011, 12:51:16 am »
Thanks, that did the trick!

I assume all this is gleaned from the database structure and painful experience, or is there some hidden documentation I haven't found yet?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: SqlQuery'ing t_taggedvalue
« Reply #4 on: May 29, 2011, 04:25:47 am »
blawton,

You haven't missed anything, there just isn't any documentation about the EA database.

Geert
(and YES it's painful ;D)