Author Topic: Custom SQL Search does not select packages  (Read 3943 times)

Dave_Bullet

  • EA User
  • **
  • Posts: 295
  • Karma: +0/-0
    • View Profile
Custom SQL Search does not select packages
« on: April 03, 2008, 10:48:03 am »
Hi there,

I've written a custom SQL search to return all objects meeting certain criteria.  I include object_type and object_id in the result set so when the user clicks the search result, the object is highlighted in the project browser.

The above works for all elements except packages.  Do I need to return any other columns to make package selection work within the project browser or is this a bug?

Thanks,
David.
"I know I'm close to a good design, but it's like the balloon animals, squeeze in one spot and the problem moves down the line"

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Custom SQL Search does not select packages
« Reply #1 on: April 03, 2008, 11:51:52 am »
David,

Remember that packages have a sort of split personality. They appear in both the t_package (for attributes related to how packages work and the project structure) and t_object (for those attributes that relate to the package as an element.

Many parts of EA treat packages differently, since they are the way in which a project is organized. You might need to deal with the the Package_ID field instead of object_id.

David
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: Custom SQL Search does not select packages
« Reply #2 on: April 03, 2008, 12:28:05 pm »
Try selecting the ea_guid as CLASSGUID instead of the object_id.

See http://www.sparxsystems.com.au/EAUserGuide/index.html?creating_filters.htm#SQL

Dave_Bullet

  • EA User
  • **
  • Posts: 295
  • Karma: +0/-0
    • View Profile
Re: Custom SQL Search does not select packages
« Reply #3 on: April 03, 2008, 12:51:40 pm »
Thanks David.  I didn't think object_id was it then tried package_id and no difference.

Spot on Simon!  the ea_guid as CLASSGUID worked a treat!.  the ea
_guid is suppressed on output (even better).  The help implied it was used to link an object so properties dialog can be displayed.  I should have tried it anyway...

To help our community, here is the useful little SQL search for finding any duplicate objects with a stereotype of "application".  Omit the search term and it will find all.

I've also found some "#ifdef" type directives you can use in your SQL query searches that allow you to code different syntaxes if using the same search against say a local EAP and central RDBMS.  I'll post these in due course.  Them Sparx boys have thought of everything  ;)

select name, alias, note, object_type, stereotype, ea_guid as CLASSGUID
from t_object
where name + object_type in
(select name + object_type
from t_object
where stereotype = 'application'
and lcase(name) like lcase('*<Search Term>*')
group by name + object_type
having count(*) > 1)
order by t_object.name


Cheers
"I know I'm close to a good design, but it's like the balloon animals, squeeze in one spot and the problem moves down the line"