Book a Demo

Author Topic: Search the text within relationships  (Read 8414 times)

YogaMatt

  • EA User
  • **
  • Posts: 111
  • Karma: +8/-0
    • View Profile
Search the text within relationships
« on: February 16, 2016, 01:49:28 am »
Using the Search Query Builder, when adding a filter, there is no option in the "Active Filter Set" drop down list for a relationship.
Is the only way to search the text within relationships to do it within an SQL search on the model?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Search the text within relationships
« Reply #1 on: February 16, 2016, 01:52:51 am »
Probably yes. But once you are used to the flexibility of SQL Searches, you'll never want to go back  ;D

Geert

YogaMatt

  • EA User
  • **
  • Posts: 111
  • Karma: +8/-0
    • View Profile
Re: Search the text within relationships
« Reply #2 on: February 16, 2016, 02:01:55 am »
I suspect you're right - so I'm now hunting for the definition of the tables I can search.
SELECT TABLE_NAME FROM <DATABASE_NAME>.INFORMATION_SCHEMA.Tables ORDER BY TABLE_NAME gives me a long, unfamiliar list!
Wish me luck!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Search the text within relationships
« Reply #3 on: February 16, 2016, 03:08:18 am »
try this:

Code: [Select]
select c.ea_guid AS CLASSGUID, c.Connector_Type AS ClassType, c.name, source.name as Source, target.name as Target,
package.name as PackageName ,package_p1.name as PackageLevel1,package_p2.name as PackageLevel2,package_p3.name as PackageLevel3
from (((((( t_connector c
inner join t_object  source on c.Start_Object_ID = source.Object_ID)
inner join t_object target on c.End_Object_ID = target.Object_ID)
inner join t_package package on source.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 c.Notes like '#WC#<Search Term>#WC#'

YogaMatt

  • EA User
  • **
  • Posts: 111
  • Karma: +8/-0
    • View Profile
Re: Search the text within relationships
« Reply #4 on: February 16, 2016, 03:47:19 am »
Fantastic Geert
In and around other calls on my time I'd got to:
SELECT Connector_Type, c.Name as "Relationship", os.Name as Source, od.Name as Dest, c.Notes as C_Notes, ps.Notes, pd.Notes
FROM t_connector c
inner join t_object os on os.Object_ID = c.Start_Object_ID inner join t_objectproperties ps on ps.Object_ID = os.Object_ID
inner join t_object od on od.Object_ID = c.End_Object_ID inner join t_objectproperties pd on pd.Object_ID = od.Object_ID

But I'd stalled as I realised I'd need some mechanism to insert the search term. Came back to the forum for it, and there it was!  :)
You've given me a great fish. Now, so that I can fish myself, can you point me at the table definitions and any help sources on e.g. the #WC#<Search Term>#WC# macro?
Many, many thanks.

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: Search the text within relationships
« Reply #5 on: February 16, 2016, 06:08:27 am »
Hi,

There is a blog post on Geerts site that explains some of those http://bellekens.com/2011/01/14/harvesting-the-power-of-eas-sql-searches/

You can also search the online sparx help, there is a page that explains all special tags that can be used in SQL from sparx.

Regards,

Jon.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Search the text within relationships
« Reply #6 on: February 16, 2016, 06:32:53 am »
Next to my site, all the documentation is actually in the manual.
See http://sparxsystems.com/enterprise_architect_user_guide/12.1/building_models/creating_filters.html

Geert

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Search the text within relationships
« Reply #7 on: February 16, 2016, 07:50:06 am »
Probably yes. But once you are used to the flexibility of SQL Searches, you'll never want to go back  ;D

You've never sounded more like Goldmember :-)

YogaMatt

  • EA User
  • **
  • Posts: 111
  • Karma: +8/-0
    • View Profile
Re: Search the text within relationships
« Reply #8 on: February 16, 2016, 07:51:13 pm »
Thanks everyone - I'm on my way!  :)