Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: SaZ on May 01, 2012, 12:47:34 am

Title: Search-based Report
Post by: SaZ on May 01, 2012, 12:47:34 am
Hi everyone,

I'm trying to generate a report selecting some packages using an SQL search : SELECT ea_guid AS CLASSGUID, Object_Type AS CLASSTYPE FROM t_object WHERE t_object.Stereotype ="ABOPackage"

The selection works fine, the problem is that when I apply my template to the result of the query, the template reads the result-packages as a simple elements instead of reading it as  packages, and so I don't have all the elements included in the packages in my report...somebody could please help me?

Thank you veeery veeery much!!
Title: Re: Search-based Report
Post by: qwerty on May 01, 2012, 01:55:55 am
Not sure whether the following would be the solution:
Code: [Select]
SELECT
 p.ea_guid AS CLASSGUID, 'Package' AS CLASSTYPE
FROM t_package p, t_object o
WHERE
 p.package_id = o.package_id and o.object_type = 'Package' AND
t_package.Stereotype ="ABOPackage"

q.
Title: Re: Search-based Report
Post by: Geert Bellekens on May 02, 2012, 03:38:11 pm
I don't even think you need t_object for that.

Geert
Title: Re: Search-based Report
Post by: SaZ on May 02, 2012, 04:04:40 pm
Hi qwerty, the query you gave me return an error: "Too few parameters. Expected 1."

Hi Geert, I don't exactly what you mean to do the query without "t_object" could you please write me the query which you mean??

I'm struggling with this problem since day!! Thank you very much!
Sam
Title: Re: Search-based Report
Post by: SaZ on May 02, 2012, 04:09:19 pm
I cannot write "t_package.Stereotype" this simply doesn't exists!
Title: Re: Search-based Report
Post by: SaZ on May 02, 2012, 04:20:13 pm
This doesn't give me error:
SELECT p.ea_guid AS CLASSGUID, 'Package' AS CLASSTYPE, p.Name FROM t_package p, t_object o WHERE p.package_id = o.package_id and o.object_type = 'Package' AND o.Stereotype ="aBOPackage"

But what I'm getting back is just the super-package of what I'm looking for and this one also just as an Element and not as a package!! How can i get back a package from an SQL-query??? The whole package with all his elements in it?

Tank you very much!!
Sam
Title: Re: Search-based Report
Post by: Geert Bellekens on May 02, 2012, 04:23:30 pm
No, that's not what you want.
The t_object.package_id is the id the the owner package, not the package id of the object (of type package)
You need to use the value in p_data1 to join t_object and t_package

Geert
Title: Re: Search-based Report
Post by: SaZ on May 02, 2012, 04:45:47 pm
Ok I see, but what you mean exactly with "use the value in p_data1"? Can you write me the query? Many many thanks!!!
Title: Re: Search-based Report
Post by: SaZ on May 02, 2012, 05:08:41 pm
The problem is always that I don't get a package back but only an element!! How can I get a package back??

Cheers
Sam
Title: Re: Search-based Report
Post by: Geert Bellekens on May 02, 2012, 05:09:28 pm
Quote
from t_package
inner join t_object on t_package.package_ID = t_object.pdata1
but then you have to add the appropriate syntax/casts to make it work depending on your repository type.

Geert
Title: Re: Search-based Report
Post by: SaZ on May 02, 2012, 05:16:12 pm
With the search I really find the package that I want (of type package), but when I apply the template to my result it treats it as a single element istead  of navigate it as a normal package!!

I really need some help! Thank you!!
Title: Re: Search-based Report
Post by: SaZ on May 02, 2012, 05:22:09 pm
Quote
Quote
from t_package
inner join t_object on t_package.package_ID = t_object.pdata1
but then you have to add the appropriate syntax/casts to make it work depending on your repository type.

Geert

How Can I do a cast? What is pdata1?
Title: Re: Search-based Report
Post by: SaZ on May 02, 2012, 05:27:43 pm
Could you not please write the whole sql-query selecting the Packages having Stereotype-value = 'someStereo' and returning the resulting packages as packages which contains all his subelements and can be used to apply a template on them?
Title: Re: Search-based Report
Post by: SaZ on May 02, 2012, 05:38:41 pm
The query should return results from my own project in EA which I'm actually working on, I'm not using some repository...
Title: Re: Search-based Report
Post by: SaZ on May 02, 2012, 06:53:50 pm
Could anybody please help?? I really need it!!

Sam
Title: Re: Search-based Report
Post by: qwerty on May 02, 2012, 08:27:56 pm
Quote
Not sure whether the following would be the solution:
Code: [Select]
SELECT
 p.ea_guid AS CLASSGUID, 'Package' AS CLASSTYPE
FROM t_package p, t_object o
WHERE
 p.package_id = o.package_id and o.object_type = 'Package' AND
o.Stereotype ="ABOPackage"

q.

See corrected quote above. Of course you need o.stereotype.

You should check out my book (see link below). When you look into the t_package description you will find out why you need t_object for the query.


q.
Title: Re: Search-based Report
Post by: Geert Bellekens on May 02, 2012, 08:56:51 pm
q,

Are you sure about the join between t_object and t_package?
I would do:

Code: [Select]
SELECT
p.ea_guid AS CLASSGUID, 'Package' AS CLASSTYPE
FROM t_package p, t_object o
WHERE
p.package_id = o.pdata1 and o.object_type = 'Package' AND
o.Stereotype ="ABOPackage"

Geert
Title: Re: Search-based Report
Post by: Stefan Bolleininger on May 02, 2012, 09:53:36 pm
Hi,

is that really, what SaZ wants? i assume SaZ wants to have the full iterative report on the package.

The query surely give the right packageelement but it is needed to runReport on the package to get all its content.

That would be my assumption for this topic.

possibility: you can package.runreport on the package from the query and use a specific template for this.
Title: Re: Search-based Report
Post by: RoyC on May 03, 2012, 09:38:49 am
SaZ, if you have not already done so, I think you need to contact Sparx Support, either with a Bug Report (use the link in the Support column at the bottom of this page) or as an email to [email protected].

Other members of the community are having an active discussion of your problem, but it looks as if you are not finding it easy to understand them. Get Support to help you.
Title: Re: Search-based Report
Post by: SaZ on May 03, 2012, 11:50:11 pm
I tried out all the queries that you gave me and a implemented other ones. Many of them find the right package, BUT THE PROBLEM IS LIKE I SAID, THAT WHEN I APPLY THE TEMPLATE ON THE PACKAGE THAT I FOUND, THE TEMPLATE INTERPRETS THE FOUND PACKAGE AS A SIMPLE ELEMENT AND NOT AS A PACKAGE WITH ALL HIS ELEMENTS IN IT!!!

So I really think this is a bug...or do you have some TESTED SOLUTION  for my case???

Thank you very much!
Sam
Title: Re: Search-based Report
Post by: RoyC on May 04, 2012, 09:04:17 am
Sam, I'm not sure that you realise that you are addressing other users such as yourself. The people who are trying to help you are not Sparx Systems employees, and have no obligation to respond to you. This is a USER forum and Sparx employees only join it on a casual basis - again, they have no obligation to respond to users through this channel.

Please contact Sparx Support for assistance in resolving your problem.