Book a Demo

Author Topic: Find instances?  (Read 2726 times)

Julian Elve

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Find instances?
« on: February 09, 2011, 09:21:50 pm »
I am using Deployment models to map out our installed configuration.

Following the example in EAExample, I have set up nodes to model the physical server types, and am using instances of those nodes to represent actual servers.

How would I find all instances of a given node? (i.e. all the times we have deployed a given hardware type). There's a "Find in All Diagrams" context menu option from which I can get all uses of a classifier, but that would miss anything not on a diagram, and show duplicates where the same instance appears in more than one diagram.

Any one else tried something similar? The same logic would be to find all object instances of a given class.



Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Find instances?
« Reply #1 on: February 09, 2011, 10:50:56 pm »
You could use an sql search to do so.
You would have to select from t_object to find the instances, and join with t_object again on parentID to find the classifiers.

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Find instances?
« Reply #2 on: February 09, 2011, 11:03:59 pm »
Sorry, I was wrong, you have to join on t_object.classifier.
Try this query:
Code: [Select]
select instance.ea_guid as CLASSGUID,instance.Object_Type as CLASSTYPE,instance.name as Name, classifier.name as 'Classifier Name'
,package.name as 'Package Name'
,package_p1.name as 'Package level -1',package_p2.name as 'Package level -2',package_p3.name as 'Package level -3'
from (((((t_object instance
inner join t_object classifier on instance.classifier = classifier.object_id  )
inner join t_package package on instance.package_id = package.package_id)
left join t_package package_p1 on package_p1.package_id = package.parent_id)
left join t_package package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package package_p3 on package_p3.package_id = package_p2.parent_id)
where classifier.name like '#WC#<Search Term>#WC#'

Geert

Julian Elve

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Find instances?
« Reply #3 on: February 09, 2011, 11:56:20 pm »
Thank you so much!