Book a Demo

Author Topic: Search text in package  (Read 4431 times)

mrblack12

  • EA User
  • **
  • Posts: 67
  • Karma: +0/-0
    • View Profile
Search text in package
« on: April 17, 2013, 11:07:17 pm »
Hi,

i'm looking for a way to search for a particular string of text within a package and its subpackages. The search text need only be in the notes of an element, so no searching is needed in object names or attributes...

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 text in package
« Reply #1 on: April 17, 2013, 11:25:15 pm »
You can do something like that using SQL Searches.
I've written a blog post once on them: http://geertbellekens.wordpress.com/2011/01/14/harvesting-the-power-of-eas-sql-searches/

You'll have to use the #Branch# macro to limit the results to the package you need.
Something like
Code: [Select]
select c.ea_guid as CLASSGUID,c.object_type as CLASSTYPE,c.name as Name, c.stereotype as Stereotype ,package.name as PackageName ,package_p1.name as PackageLevel1,package_p2.name as PackageLevel2,package_p3.name as PackageLevel3
from t_object c
join t_package as package on (c.package_id = package.package_id)
left join t_package as package_p1 on (package_p1.package_id = package.parent_id)
left join t_package as package_p2 on (package_p2.package_id = package_p1.parent_id)
left join t_package as package_p3 on (package_p3.package_id = package_p2.parent_id)
where c.note like '#WC#<Search Term>#WC#'
and c.package_ID in (#Branch#)

Geert

mrblack12

  • EA User
  • **
  • Posts: 67
  • Karma: +0/-0
    • View Profile
Re: Search text in package
« Reply #2 on: April 18, 2013, 12:12:50 am »
Geert,
this looks really good.. Unfortunately I'm getting an "error in FROM clause' when I'm trying to run the query in EA...

Rick

mrblack12

  • EA User
  • **
  • Posts: 67
  • Karma: +0/-0
    • View Profile
Re: Search text in package
« Reply #3 on: April 18, 2013, 12:34:47 am »
Right,

got it working now: something to do with to few closing brackets... ;D

thanx again!

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 text in package
« Reply #4 on: April 18, 2013, 02:01:44 am »
Yes, sorry. I'm used to MS SQL syntax, and Access (.eap file) requires some extra brackets)

Geert