Sparx Systems Forum

Enterprise Architect => Bugs and Issues => Topic started by: Dave_Bullet on April 03, 2008, 10:48:03 am

Title: Custom SQL Search does not select packages
Post by: Dave_Bullet 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.
Title: Re: Custom SQL Search does not select packages
Post by: «Midnight» 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
Title: Re: Custom SQL Search does not select packages
Post by: Eve 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
Title: Re: Custom SQL Search does not select packages
Post by: Dave_Bullet 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