Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Luigi2021 on December 01, 2021, 09:17:03 pm

Title: SQL Search selected or zero results returned
Post by: Luigi2021 on December 01, 2021, 09:17:03 pm
Hi,

I am generating a document from templates that contain fragments that make use of a custom query. If the fragment's custom query doesn't return any results I get the following error in the System Output window:  "SQL Search selected or zero results returned". I am not sure if it makes a difference for the answer but the fragment contains a hyperlink only. How can I solve this problem?

p.s. a workaround would be to let the SQL always return some kind of value. But since I think having zero results is not an error condition (maybe a warning/hint would be more appropriate) I guess/hope that there are other options.

Thanks in Advance!

Luigi
Title: Re: SQL Search selected or zero results returned
Post by: OpenIT Solutions on December 03, 2021, 02:38:50 am
Hi,

If the SQL for a fragement returns 0 rows, the detail of the framgment will not be included in the report. Is this what your expecting ?

Regards,

Jon.
Title: Re: SQL Search selected or zero results returned
Post by: Luigi2021 on December 03, 2021, 07:08:17 pm
That is indeed what I expect.
Title: Re: SQL Search selected or zero results returned
Post by: Luigi2021 on December 04, 2021, 03:23:37 am
@OpenIT Solutions I think I misread you answer.

Do you mean that there shouldn't be an error in the case that the fragment returns 0 rows?
Title: Re: SQL Search selected or zero results returned
Post by: Luigi2021 on December 08, 2021, 02:59:45 am
I finally found the problem. My SQL looked like this:
Code: [Select]
SELECT *
FROM
(
SELECT #Concat t_object.ea_guid,t_object.Name# AS [BaseClassName.Hyperlink]
FROM t_connector  JOIN t_object  ON t_connector.End_Object_ID = t_object.Object_ID
WHERE
 t_connector.Start_Object_ID = #OBJECTID#
AND
 t_connector.Stereotype = 'TechDoc Trace'
UNION
SELECT #Concat t_object.ea_guid,t_object.Name# AS [BaseClassName.Hyperlink]
FROM t_connector  JOIN t_object  ON t_connector.Start_Object_ID = t_object.Object_ID
WHERE
 t_connector.End_Object_ID = #OBJECTID#
AND
 t_connector.Stereotype = 'TechDoc Trace'
) AS A
ORDER BY 1 ASC

Changing the * to [BaseClassName.Hyperlink] did the trick.