Author Topic: Filter on Element Attribute Value  (Read 1784 times)

ravitech

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Filter on Element Attribute Value
« on: July 18, 2017, 01:02:39 pm »
I have a set of name/value pairs associated to each element in my diagram.
Currently, I have loaded these name/value pairs as attributes and initial values for the elements.

Now, I have a requirement to generate a report of all elements with a specific value for a specific attribute.
How do I do this? I can see there are element attribute filters and I can do a model search on attribute names.
But how do I report on attribute values?

Or is there any alternative way to do this?

Guillaume

  • EA User
  • **
  • Posts: 983
  • Karma: +30/-2
    • View Profile
    • www.umlchannel.com
Re: Filter on Element Attribute Value
« Reply #1 on: July 18, 2017, 06:10:15 pm »
Hi,

You can run a SQL search as illustrated below.
It will return class attrbutes with an initial value matching your search criteria. The only down side is that you have to change the diagram ID in the SQL when you change diagrams.

Alternatively, you can run this query in a script that runs on a diagram and prompts for the initial value. This script can generate the results in the system output


SELECT t_object.ea_guid AS CLASSGUID, t_object.Object_Type as CLASSTYPE, t_object.Name as Class, t_attribute.Name as Attribute
FROM (( t_object
inner join t_diagramobjects on t_object.Object_ID = t_diagramobjects.Object_ID)
inner join t_attribute on t_object.Object_ID = t_attribute.Object_ID)
WHERE
t_diagramobjects.Diagram_ID = 1085
AND t_object.Object_Type = 'Class'
AND t_attribute.Default = '<Search Term>'
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


ravitech

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Filter on Element Attribute Value
« Reply #2 on: July 19, 2017, 05:57:48 am »
Thanks for your reply.
But, I am looking for name/value match.

I want to filter on elements that have a specific value for a specific attribute.

Example:

Element A
Attribute Name "PPO" Attribute Value "Y"
Attribute Name "HMO" Attribute Value "N"

Element B
Attribute Name "PPO" Attribute Value "N"
Attribute Name "HMO" Attribute Value "Y"

I want to filter on all elements with an attribute HMO = Y.
In this case the search / report should return only Element B. 

Should I be using something else instead of attributes to filter on name/value pairs?