Book a Demo

Author Topic: Virtual Document and SQL Search  (Read 6636 times)

DhoX

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Virtual Document and SQL Search
« on: June 08, 2011, 08:56:55 pm »
Hello,
I need a SQL Search for my Virtual Document.

The Search should only give the Package with the Name X (<- my search term) from my Project back (with SearchName and SearchValue in a <<model document>>)

I got the Following SQL Search:
SELECT t_object.ea_guid AS CLASSGUID,
       t_object.Object_Type AS CLASSTYPE,
       t_object.Name
FROM   t_object
WHERE  t_object.Object_Type = 'package'
AND    t_object.Name = '<Search Term>'

In the Find Window, i found the Package with the searched Name, but if i use it with the Modul Document, something goes wrong, No Error but in the generated Document there is only the Template shown.
What Am I doing wrong?

Like in the User Guide written I only use the search not both (search and a Package)

I used the Forumsearch before, but only found Solutions for Errors or
proposal for solutions that look like mine!
So is there anywhere a Option i need to set or something?

A simple Packagesearch or Package_ID search couldn't be impossible, or? -.-

Best Regards
DhoX
« Last Edit: June 09, 2011, 12:53:02 am by 0101010101 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Virtual Document and SQL Search
« Reply #1 on: June 09, 2011, 05:26:30 pm »
It could be that you have to query t_package iso t_object.
Have you tried that?

Geert

DhoX

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Virtual Document and SQL Search
« Reply #2 on: June 09, 2011, 05:35:03 pm »
Stupid Question but how would you write it?
All my tries with t_package gives errors, but i think thats based on my SQLskills and not on the impossibility. ;)

But why gives the normal "find in Model"-Search a result and in the model document seemingly not?
« Last Edit: June 09, 2011, 05:36:32 pm by 0101010101 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Virtual Document and SQL Search
« Reply #3 on: June 09, 2011, 05:42:37 pm »
Something like this:
Code: [Select]
select p.ea_guid as CLASSGUID,'Package' as CLASSTYPE,p.Name
from t_package p
where p.name like '<Search Term>'

Geert

DhoX

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Virtual Document and SQL Search
« Reply #4 on: June 09, 2011, 06:07:36 pm »
Actual Situation:

My Sql Search Named "Test Search" looks like:
SELECT p.ea_guid AS CLASSGUID,
       'Package' AS CLASSTYPE,
         p.Name
FROM t_package p
WHERE p.name LIKE '<Search Term>'


Again in "Find in Model"-Search it found the Packages.

Now if i want to generate the <<master document>>, that contains a
<<model document>> with the following taggedValues:
RTFTemplate      GT Test
SearchName      Test Search    
SearchValue      Adc            

Like in the User Guide written, the SearchValue should be the Searchterm or?

But now i got the following Error:
DAO.Database[3061]
too few parameters. Expected 1.

So my SearchValue isn't functional or?
But why?
« Last Edit: June 09, 2011, 06:09:51 pm by 0101010101 »

DhoX

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Virtual Document and SQL Search
« Reply #5 on: June 09, 2011, 08:30:36 pm »
The Output Window gets the following Message:
SQL Search selected or zero results returned

But the Package Exists and like said before,
in the "Find in Model"-Searchwindow I find the Package with the same search and searchterm.
I don't understand where the difference between the "find in model"-Searchwindow and the <<model document>> usage of the same search is ...

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Virtual Document and SQL Search
« Reply #6 on: June 10, 2011, 07:28:01 am »
You haven't said what database you're running on, but some databases would fail on the lowercase 'name' in your where clause.

DhoX

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Virtual Document and SQL Search
« Reply #7 on: June 10, 2011, 05:52:43 pm »
I don't understand that Question.
Do I need a Database for the search?
But I tested it with Name and it also fails.

If i understand it right, i can use such a select search to find a package from my Enterprisearchitect model in the project browser.
Or in the case of the model document, the result of the search (in this case a package) is used by the <<model document>> same as a package that i would add via drag and drop to the <<model document>>. Or am i wrong?

Or what other options to replace this package to <<model document>> adding via drag and drop with a Add-In or Automation do i have?
« Last Edit: June 10, 2011, 05:53:39 pm by 0101010101 »

SaZ

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Virtual Document and SQL Search
« Reply #8 on: May 02, 2012, 06:27:25 pm »
Hi DhoX I'm sticking with the same problem and actually I found out, that your query just return an Element (namely the package-element you were searching for). Thus you just have a single element instead of the whole package containing all his elements...so when you apply your template to the result it doesn't find any element in your result...thats why the whole thing is not working!
Unfortunately I also didn't find any solution, did you???? Thank you very much!

Sam

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Virtual Document and SQL Search
« Reply #9 on: May 02, 2012, 08:21:07 pm »
If you need all elements in a package you need to specify
Code: [Select]
SELECT * FROM t_object o, t_package p
WHERE o.package_id = p.package_id and p.name = '<Search Term>'

Apply CLASSGUID etc instead of * if desired.

You might be interested in my book (see link below) which details a bit of the internal EA data structures.

q.
« Last Edit: May 02, 2012, 08:22:23 pm by qwerty »