Author Topic: Search-based Report  (Read 8488 times)

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Search-based Report
« 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!!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Search-based Report
« Reply #1 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.
« Last Edit: May 01, 2012, 01:56:55 am by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Search-based Report
« Reply #2 on: May 02, 2012, 03:38:11 pm »
I don't even think you need t_object for that.

Geert

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Search-based Report
« Reply #3 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

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Search-based Report
« Reply #4 on: May 02, 2012, 04:09:19 pm »
I cannot write "t_package.Stereotype" this simply doesn't exists!

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Search-based Report
« Reply #5 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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Search-based Report
« Reply #6 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

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Search-based Report
« Reply #7 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!!!

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Search-based Report
« Reply #8 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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Search-based Report
« Reply #9 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

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Search-based Report
« Reply #10 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!!

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Search-based Report
« Reply #11 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?

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Search-based Report
« Reply #12 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?

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Search-based Report
« Reply #13 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...

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Search-based Report
« Reply #14 on: May 02, 2012, 06:53:50 pm »
Could anybody please help?? I really need it!!

Sam