Author Topic: #Object# macro for Model Search  (Read 5600 times)

Van Lepthien

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
#Object# macro for Model Search
« 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
f.Classifier_guid = s.ea_guid
s.Object_ID = #Object#

Is this needed enough to make a formal request?

Helmut Ortmann

  • EA User
  • **
  • Posts: 967
  • Karma: +42/-1
    • View Profile
Re: #Object# macro for Model Search
« Reply #1 on: October 17, 2012, 07:02:34 pm »

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,


Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)