Book a Demo

Author Topic: Sending Search results to an add-in  (Read 3480 times)

brankin

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Sending Search results to an add-in
« on: January 17, 2008, 10:48:57 am »
Here is an edited version of an email discussion I had with a co-worker.

I was looking at the search capabilities for EA and ran a simple search. I sorted the search results by element type and selected all of the requirements. If you right click, you get the option to run a separate RTF report on each selected element or run one RTF report for all of the selected elements. The question I have is how can the selected elements be directed to an add-in report?
-B


Try selecting Add-Ins from the main menu instead of right-clicking.
-R


That doesn't seem to work. What happens is that when I shift-select multiple elements, the first one selected is also selected in the Project Browser and it uses that element's parent package as the source for the report.
-B


Here's an idea, use the option to bookmark the selected items and then run the add-in report on the highest level package necessary to capture all of the elements. If the add-in can be made to only process bookmarked items, then I think that would work. There is an easy option to clear the bookmarks after the report is run.
-B


I don’t see any class members in the EA Automation API that support accessing bookmarks. It looks like they may not export bookmarks in the API for automation use. They must store the bookmarks someplace, but they may be only for internal use. Maybe bookmarks could be accessed directly from the database.

So far, it looks like the only way of aggregating elements for automation is via a virtual document, though maybe I’m overlooking something.

What would be handier for the functionality you’d like is that EA pass a collection of packages or elements to the Add-In instead of just one package. Then we could just go through and process each element in the collection. There appear to be four methods to access selected items from the tree: GetTreeSelectedPackage() (the one we’re using), GetTreeSelectedItem(), GetTreeSelectedItemType(), and GetTreeSelectedObject(). They all return just one object.

This might be a feature to request for the next version of EA. If we could get multiple selections from the tree then we could do what you request. It looks like multiple selections are available in the system if you can run RTF reports on them. I just don’t see how we can get them for EA automation.
-R


So forum people, do you have any suggestions on how to pass multiple selected elements to an add-in?

thomaskilian

  • Guest
Re: Sending Search results to an add-in
« Reply #1 on: January 18, 2008, 12:18:18 am »
AFAIK there is only one method to get a SINGLE element from the browser (GetTreeSelectedObject) while for diagrams you have access to multiple selected items (SelectedObjects). EAUI - ask for an enhancement...

brankin

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Sending Search results to an add-in
« Reply #2 on: January 18, 2008, 08:33:56 am »
Here is my current idea on how to solve this problem. I'll let you know if it works.

Take the search results or a selected group of the results and send them to the RTF report generator, and only print a simple list of their GUIDs. Then use the file containing the GUIDs as an input to an add-in that is run against the entire model, picking out the GUIDs of the elements in the file and performing more complex processing and reporting.

Has anyone else done something similar?

thomaskilian

  • Guest
Re: Sending Search results to an add-in
« Reply #3 on: January 23, 2008, 07:11:24 am »
Easier: execute the SQL directly from within your add-in. Then evaluate the GUIDs. That should be much faster/easier...