Author Topic: Search addin  (Read 5486 times)

lubos

  • EA User
  • **
  • Posts: 101
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Search addin
« on: December 23, 2008, 07:29:25 pm »
Hello,
could you introduce or even better provide some example of implementing some addin search?

The documentation is not clear for me enough.

I have the following method:

Code: [Select]
public static void findAllImported(EA.Repository rep,string searchString,ref string XML)
        {
            XML = rep.SQLQuery("select c.ea_guid AS CLASSGUID,o.name as 'TABLE', c.name as 'Attribute', c.Type as 'TYP' from t_object o, t_attribute c where o.stereotype='table' and c.stereotype='column' and c.object_id=o.object_id and LOWER(c.name) IN ('smlouva')");
        }

but this method should return something as stated in help.

And my addin is called 'EAPlugin.TC'
so i don't know how to define the search profile to run it

Code: [Select]
EAPlugin.TC.findAllImported ??

Thanks for any hints

P.S. I know that functionality of this concrete search is realizable by SQL search but it serves me only for testing purposes...

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Search addin
« Reply #1 on: December 24, 2008, 11:48:15 am »
Have you tried your SQL select statement in EA's custom query editor? (Ctrl+F and click "Manage Searches"). When I try it I get the error message:

Quote
Undefined function 'LOWER' in expression.
I don't know enough SQL to know what to use instead.
« Last Edit: December 24, 2008, 11:50:43 am by KP »
The Sparx Team
[email protected]

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Search addin
« Reply #2 on: December 24, 2008, 12:19:18 pm »
Quote
Have you tried your SQL select statement in EA's custom query editor? (Ctrl+F and click "Manage Searches"). When I try it I get the error message:

Quote
Undefined function 'LOWER' in expression.
I don't know enough SQL to know what to use instead.

I'm told the answer is 'LCase' to convert to lower case (and 'UCase' to convert to upper).
The Sparx Team
[email protected]

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Search addin
« Reply #3 on: December 24, 2008, 12:33:45 pm »
Quote
I'm told the answer is 'LCase' to convert to lower case (and 'UCase' to convert to upper).
Another correction: 'LCase' works with Access SQL (i.e. EAP files), other repositories will use 'LOWER'. I'm learning stuff today! :)
The Sparx Team
[email protected]

lubos

  • EA User
  • **
  • Posts: 101
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Search addin
« Reply #4 on: January 07, 2009, 06:47:33 pm »
yes, we use MSSQL.
The search SQL is OK we use it as SQL search. But now I want to create some addin search and I'm not sure how to do it so I'm looking for some example


visnak

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Search addin
« Reply #5 on: January 11, 2009, 10:13:26 pm »
1) declare your method like
public Boolean SearchView(EA.Repository Rep, String SearchText, out String XMLResults)

2) string XMLResults has different structure then return Repository.SqlSearch method

3) for right format XMLResults string find page "XML Format (Search Data)" in EA user guide
 :)

lubos

  • EA User
  • **
  • Posts: 101
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Search addin
« Reply #6 on: January 14, 2009, 08:03:23 pm »
i have rewrited the method :

Code: [Select]
public static bool findAllImported(EA.Repository rep,string searchString,ref string XML)
        {
            
            XML =@"<ReportViewData>  
       <Fields>
               <Field name=""neco""/>
               <Field name=""neco2""/>
               <Field name=""neco3""/>
       </Fields>
       <Rows>
               <Row>
                       <Field name=""neco"" value=""1""/>
                       <Field name=""neco2"" value=""2""/>
                       <Field name=""neco3"" value=""3""/>                      
               </Row>
               <Row>
                       <Field name=""neco"" value=""a""/>
                       <Field name=""neco2"" value=""b""/>
                       <Field name=""neco3"" value=""c""/>                      
               </Row>
       </Rows>
</ReportViewData>";
            return true;
        }

and defined new search as Add-In Search  referencing:
Code: [Select]
EAPlugin.TC.findAllImported

but it doesn't return nothing...still not working

What  do I wrong? Thanks for any hints

visnak

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Search addin
« Reply #7 on: January 14, 2009, 08:37:30 pm »
You have bad declaration
public static bool findAllImported(EA.Repository rep,string searchString,ref string XML)

You must use
public bool findAllImported(EA.Repository rep,string searchString,out string XML)

lubos

  • EA User
  • **
  • Posts: 101
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Search addin
« Reply #8 on: January 14, 2009, 09:24:45 pm »
yes I have actually tested both variants but any didn't worked.

I'm still not sure with  "EAPlugin.TC.findAllImported"  refence string.
I don't want to rename the name of the plugin.

visnak

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Search addin
« Reply #9 on: January 14, 2009, 09:29:17 pm »
If You have EA AddIn named "EAPlugin"
remove findAllImported to EAPlugin.cs
and call this method by EAPlugin.findAllImported in EA Search

lubos

  • EA User
  • **
  • Posts: 101
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Search addin
« Reply #10 on: January 14, 2009, 10:41:00 pm »
when defining new addin and specifying "Addin Name and method", the addin name is the name of the component or the name of an addin under HKEY_CURRENT_USER\Software\Sparx Systems\EAAddIns key ??

The name of the component is quite difficult to change for me, but the second solution is acceptable. (I have both names the same now).

Actually i have tested to rename the  addin name under EA reg keys and it still doesn't work ... may be I have problem somewhere else, I will try to play with it..

Thanks for quick reactions ;-)

visnak

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Search addin
« Reply #11 on: January 14, 2009, 10:47:03 pm »
I think that You must use component name
Do You try move findAllImported to EAPlugin.cs?

lubos

  • EA User
  • **
  • Posts: 101
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Search addin
« Reply #12 on: January 14, 2009, 10:52:17 pm »
HEUREKA...it works

I did a correction to

Code: [Select]
Boolean findAllImported(EA.Repository rep, String searchString, out String XML);
from

Code: [Select]
bool findAllImported(EA.Repository rep, string searchString, out string XML);
and some other changes ;-).  I can't say what was the reason. but it WORKS.
The relevant name is realy the name of the plugin under the HKEY_CURRENT_USER\Software\Sparx Systems\EAAddIns not the name of the reference component.

thanks a lot for your support!!