Book a Demo

Author Topic: RunModelSearch  (Read 8000 times)

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
RunModelSearch
« on: February 13, 2013, 03:56:19 am »
Hi,

Is it possible to use RunModelSearch from the automation interface to run a model search and send the result to a file ?

It looks from the docs that output will always go to the Model Search screen ?

Thanks,

Jon.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: RunModelSearch
« Reply #1 on: February 13, 2013, 04:04:01 am »
Well, it has a ShowInEA: Boolean which you can obviously turn off. The output then goes to the NULL device. Seems to make a lot of sense.

I can't think of a hack to get the results since the model search understand tags like #Branch#. That way you can't even try to get the underlying SQL and perform a Repository.SQLquery.

q.

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: RunModelSearch
« Reply #2 on: February 13, 2013, 04:58:59 am »
Can you not select a package using the automation interface - that way #branch# should work - it feels like its half way there - it would be a useful feature....

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RunModelSearch
« Reply #3 on: February 19, 2013, 11:50:42 pm »
I have a case where I get the custom SQL seaches defined by the user and use their sql definitions in a call to Repository.SQLQuery()

They are defined in %AppData%\Sparx Systems\EA\Search Data\EA_Search.xml

But that doesn't work for standard searches.

Geert


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: RunModelSearch
« Reply #4 on: February 20, 2013, 12:10:03 am »
Quote
Can you not select a package using the automation interface - that way #branch# should work - it feels like its half way there - it would be a useful feature....
No. You only can select elements in a diagram (via SelectedObjects). However, being able to select an element in the browser would be a nice feature.

q.

[edit] Geert is right. I looked for the method (since not having used it for ages) and did not find it instantly.
« Last Edit: February 20, 2013, 02:43:17 am by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RunModelSearch
« Reply #5 on: February 20, 2013, 12:23:57 am »
Quote
Can you not select a package using the automation interface - that way #branch# should work - it feels like its half way there - it would be a useful feature....
Yes you can.
Code: [Select]
Repository.ShowInProjectView()
Geert

Ian Mitchell

  • EA User
  • **
  • Posts: 507
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: RunModelSearch
« Reply #6 on: May 25, 2013, 09:51:10 pm »
I think there may be a bit of confusion here.
There are two RunModelSearch methods: one in Repository, one in ProjectInterface.

ProjectInterface.RunModelSearch one has the one which just runs the search and allows for the showInEA option. Which seems to work just fine, but doesn't return the results.

Repository.RunModelSearch also runs, but the API documentation says it returns a string with the results.
Has anyone made this work? I can run it, and the search runs OK (but it also displays the results in the EA User Interface, which I don't want) but I can't get it to return any results.
In order to test it, i'm not passing any search criteria:

currentEARepository.RunModelSearch(QueryName:=strReportName,
                                                   SearchTerm:="",
                                                   SearchOptions:="",
                                                   SearchData:=strXML)

..but strXML is empty. The strReportName is OK, because the seach runs.

Is this a bug, or am I doing in wrong?
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: RunModelSearch
« Reply #7 on: May 27, 2013, 09:12:22 am »
Read the docs for Repository.RunModelSearch. That last parameter is an input of results to append to the search.

You could try using Repository.GetElementsByQuery()

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RunModelSearch
« Reply #8 on: May 27, 2013, 04:49:38 pm »
Quote
You could try using Repository.GetElementsByQuery()

True, I completely forgot about that one. :-[
That works fine, for both standard as custom SQL searches, but only if those searches return contain guid's of EA.Elements.
If you have other types of elements as the result of your search you'll have to use Repository.SQLQuery().

Geert