Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: lubos 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:
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
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...
-
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:
Undefined function 'LOWER' in expression.
I don't know enough SQL to know what to use instead.
-
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:
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).
-
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! :)
-
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
-
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
:)
-
i have rewrited the method :
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: EAPlugin.TC.findAllImported
but it doesn't return nothing...still not working
What do I wrong? Thanks for any hints
-
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)
-
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.
-
If You have EA AddIn named "EAPlugin"
remove findAllImported to EAPlugin.cs
and call this method by EAPlugin.findAllImported in EA Search
-
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 ;-)
-
I think that You must use component name
Do You try move findAllImported to EAPlugin.cs?
-
HEUREKA...it works
I did a correction to
Boolean findAllImported(EA.Repository rep, String searchString, out String XML);
from
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!!