Book a Demo

Author Topic: How can I search for all class containing a port of a specific name?  (Read 2427 times)

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
How would a SQL query look for searching the model for all classes containing a port called "P1"? Basically, I want to list all classes that have a port called "P1". This way I have an overview as to how many classes require a particular service. I can get a listing of all ports in the model that are called "P1", but I cannot get their owners.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How can I search for all class containing a port of a specific name?
« Reply #1 on: October 18, 2019, 08:09:53 pm »
Something like this should get you started
Code: [Select]
select po.ea_guid as CLASSGUID,po.Object_Type as CLASSTYPE,po.Name as Name,po.Stereotype,package.name as PackageName ,package_p1.name as PackageLevel1,package_p2.name as PackageLevel2 ,package_p3.name as PackageLevel3
from ((((t_object o
inner join t_object po on po.Object_ID = o.ParentID
inner join t_package package on o.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 o.Object_Type = 'Port'
and o.Name like '<Search Term>'

Geert