Sparx Systems Forum

Enterprise Architect => Suggestions and Requests => Topic started by: Van Lepthien on October 17, 2012, 07:57:32 am

Title: #Object# macro for Model Search
Post by: Van Lepthien on October 17, 2012, 07:57:32 am
A number of times I've wanted to use an object's ID when composing SQL searches in Model Search. The latest is "Get all objects whose classifier is X", where X is an object selected in the model.

To be consistent with the use of #Package#, I think it would be appropriate to use #Object#.

I want to be able to do this:

Code: [Select]
SELECT s.Name as ClassifierName, s.Stereotype as ClassifierStereotype, s.Object_type as ClassifierType, s.Object_ID as ClassifierId,
f.ea_guid AS CLASSGUID, f.Object_Type AS CLASSTYPE, f.Name as Name, f.Stereotype
FROM t_object s , t_object f
WHERE
f.Classifier_guid = s.ea_guid
and
s.Object_ID = #Object#

Is this needed enough to make a formal request?
Title: Re: #Object# macro for Model Search
Post by: Helmut Ortmann on October 17, 2012, 07:02:34 pm
Hello,

I think this is a useful idea.

Another way is to write a litle VBScript/JavaScript which calls the search and passes a GUID as a search string. This may look like:

Dim selectedElement as EA.Element
set selectedElement = Repository.GetTreeSelectedObject()
Repository.RunModelSearch "Element usage", selectedElement.ElementGUID, "", ""

If you put the script into the BrowserScript Group you'll have it on your right click (in Browser Tree).

Kind regards,

Helmut