Book a Demo

Author Topic: Add-In Search running in EA but not in RTF Report  (Read 9317 times)

Jonathan Lubach

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Add-In Search running in EA but not in RTF Report
« on: September 01, 2012, 12:21:51 am »
Hey,

I don't understand one thing:

I created an Add-In providing a method for an Add-In search. The method returns an XMLResult including the needed CLASSGUID and CLASSTYPE as described here: http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/add_in_search.htm and here http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/xml_format_search_data.htm

When I run this search within the "Edit -> Model Search" this runs without problems. When I add this search to a model document for reporting the resulting objects in a master document the following error message appears in the output view: "SQL Search selected or zero results returned". :-/

From the debugger I gathered, that the method is not called at all. The error message is generated as soon as the RTF generator reaches the model document where the Add-In-Search should be called.

Can anyone help me with this?
Thanks!

Jonathan
« Last Edit: September 02, 2012, 12:10:24 am by syboowa »
Enterprise Architect Corporate Edition v12.1
Windows 7 64bit

Michael Proske

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #1 on: September 20, 2012, 07:57:39 pm »
Have you added a dummy package to the model document. The search will only be excecuted when a package is assigned as attribute to the document. Does make sense because it is not used by the search but there has to be one.
Regards Michael

Jonathan Lubach

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #2 on: September 20, 2012, 09:31:10 pm »
Quote
Have you added a dummy package to the model document. The search will only be excecuted when a package is assigned as attribute to the document. Does make sense because it is not used by the search but there has to be one.

Michael, thanks for the answer. I just added a dummy package to the model document and tried generating the report again.
The error message ("SQL search selected...") does not appear but the Add-In search is also not run (debugger doesn't break at the first break point). Also there are no results in the resulting RTF.

From the EA help I understand, that if a package is assigned to a model document as attribute, NO search is run (from the topic "Create Model Document" in the chm-help):
Quote
Remember that, in a Model Document for an RTF report, you should not define both a list of packages and a search; if both are present, when you generate the RTF document Enterprise Architect works from the package list only.

Does this work in your model?

Thanks!
Jonathan
Enterprise Architect Corporate Edition v12.1
Windows 7 64bit

Embedded Office

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #3 on: October 15, 2012, 10:31:40 pm »
have you checked, that the 'AS' in ea_guid AS CLASSGUID is all upper-case?

Jonathan Lubach

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #4 on: November 27, 2012, 08:45:45 pm »
Quote
have you checked, that the 'AS' in ea_guid AS CLASSGUID is all upper-case?

I did check that, it's upper-case so it should work.

UPDATE:
Here is what I got from the EA support today:

"We have been able to reproduce the issue described in your report and this will be investigated further by our development team.  Add-in Search types cannot currently be used as the source for a model document.
[...]
Unfortunately we cannot provide any schedule for this issue to be resolved as yet"

I have used EA Version 9.3.935.

So far, let's see what happens in future :)

Jonathan
« Last Edit: November 27, 2012, 08:46:13 pm by syboowa »
Enterprise Architect Corporate Edition v12.1
Windows 7 64bit

MrSnrub

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #5 on: January 31, 2015, 02:21:53 am »
Did the issue with not being able to run add-in searches in model documents ever get fixed? I'm still stuck trying to get my add-in search to work, but if I can't run it from a model document, I've just been wasting my time.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #6 on: January 31, 2015, 08:22:46 am »
Ah. You've been digging. You'll probably get no answer here. Haven't heard from those guys since a long time. I'm also trying to get it to work and it's making pull my hairs (like so many things in EA). But that's a really tricky one. Hope I'm more lucky this weekend.

q.

Jonathan Lubach

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #7 on: February 02, 2015, 06:50:33 pm »
querty, MrSnrub,

I have tried it in the recent version EA 11.1112 and it doesn't work either. Over the past 2 years I developed a C#-add-in which partly replaces the EA-integrated document generator.

Main features of my add-in:
- The add-in main function is called with an parameter "GUID of master document package"
- Parsing of all model documents
- Calling the document generator with the API call "Repository.GetProjectInterface().RunReport()" for the normal templates (with packages as attributes)
- Calling the document generator with the API call "RepositoryCreateDocumentGenerator()" as well as the relevant item functions "DocumentGenerator().Document<...>().
- The source for the "Document<...>()" method I get from my add-in search which I identify by the "Search" and "Search-Term" tagged-values in the model document.

That's my way of getting the add-in search to work. But this may not work for everyone  :(

It's sad, that Sparx has no roadmap for this - IMHO - BUG!


If there is need for more explanation on my solution, I can post more on request.

Jonathan
Enterprise Architect Corporate Edition v12.1
Windows 7 64bit

TroyMcClure

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #8 on: February 11, 2015, 11:34:10 pm »
Jonathan

Thanks for tips. I've written an add-in and ran into a problem with DocumentPackage in the generator. It runs on the package and returns successful, but the document only contains the package title and first diagram and excludes the rest of the package. I am using the "Model Report" Template so it should return almost everything. When I run a ModelDocument it returns what I expect. But if I run the same ModelDocument in EA after the add-in I get the same results as the add-in. Seems there is another bug?

Have you ran into this issue?

Our master document contains some Model Documents that have ModelSearches. I was trying to generate one document that has model documents of normal templates and model searches. Is this possible?
 



Jonathan Lubach

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #9 on: February 11, 2015, 11:57:26 pm »
Hi TroyMcClure,

I have some questions to understand your questions correctly:

Quote
Thanks for tips. I've written an add-in and ran into a problem with DocumentPackage in the generator. It runs on the package and returns successful, but the document only contains the package title and first diagram and excludes the rest of the package.
So you are using the "DocumentGenerator" of the EA API and thereof the "DocumentPackage" method?

This method is able to document all package data, but not the data of elements or child packages and so on...
If you want to print the contents for e.g. the sub-elements of the package, you will have to iterate the elements by using the Package.Elements-collection and calling "DocumentElement" on these elements. There are different methods for each type of item (DocumentElement, DocumentPackage, DocumentDiagram...).
With the document generator class you have the ability to fully customise the structure of your generated document by using the API calls.


Quote
I am using the "Model Report" Template so it should return almost everything. When I run a ModelDocument it returns what I expect.
The internal document generator combines these calls to the "Document..."-methods according to the template given in the model document tagged values.

Quote
But if I run the same ModelDocument in EA after the add-in I get the same results as the add-in. Seems there is another bug?
What do you mean with "...after the add-in"? Do you first run the report with your add-in and then with the internal document generator?
You should get equal reports if you run the ModelDocument with the internal document generator as well as with the API-call "Repository.GetProjectInterface().RunReport()".

Quote
Our master document contains some Model Documents that have ModelSearches. I was trying to generate one document that has model documents of normal templates and model searches. Is this possible?
My master document also contains some ModelDocuments with model searches. This is working fine as long as you are not using an "add-in search" (certain type of the model search). This is not possible as you can see from recent posts here in this thread.
What do you mean with "normal templates"? Are you talking about using packages as source for the data instead of model search?

I hope this information helps.

Jonathan
Enterprise Architect Corporate Edition v12.1
Windows 7 64bit

TroyMcClure

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #10 on: February 12, 2015, 12:34:07 am »
Thanks, Sorry the unclear post.

You are correct I was referring to the DocumentPackage method. I'd agree that it might only return the top level package info. But I have a package with three diagrams in it. The report only ends up with the first one.

When I run a ModelDocument that has a package using the EA Doc Generation I get what I expect. Then I run the add-in with DocumentPackage method. Then I go back and rerun the same ModelDocument and get the same reduced results as the add-in. I have to restart EA.

I must not be using the ModelSearch(SearchName and SearchTerm) correctly. It returns all of the elements in a package and not reducing to SQL results. Update: I figured this out I can't have a package and modelsearch as they will conflict.

Thanks again.

« Last Edit: February 12, 2015, 01:09:01 am by niel.clark »

Jonathan Lubach

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #11 on: February 12, 2015, 02:55:31 am »
Hi TroyMcClure,

Quote
You are correct I was referring to the DocumentPackage method. I'd agree that it might only return the top level package info. But I have a package with three diagrams in it. The report only ends up with the first one.
I just tried generating a document with the DocumentPackage-method on my own machine with the "Model Report" system template. I got a report with the package details and ALL diagrams with are children of this package. I cannot say, why this is not working on your machine.

Quote
When I run a ModelDocument that has a package using the EA Doc Generation I get what I expect. Then I run the add-in with DocumentPackage method. Then I go back and rerun the same ModelDocument and get the same reduced results as the add-in. I have to restart EA.
That behaviour I cannot reproduce on my machine. Sorry. I would ask Sparx, if this is a known bug.

Quote
I must not be using the ModelSearch(SearchName and SearchTerm) correctly. It returns all of the elements in a package and not reducing to SQL results. Update: I figured this out I can't have a package and modelsearch as they will conflict.
Yes, you are right, this is not possible. You can either use a model search OR a package as source for the data. But you can exclude packages by using the SQL exclude feature of the model template or you can use the SQL template fragments to use SQL selections.

Regards,
Jonathan
Enterprise Architect Corporate Edition v12.1
Windows 7 64bit

TroyMcClure

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Add-In Search running in EA but not in RTF Rep
« Reply #12 on: February 12, 2015, 04:45:07 am »
Thanks for taking the time to test and reply.