Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - martin1

Pages: [1] 2 3 4
1
General Board / Re: Table containing Tagged Values
« on: August 08, 2024, 12:16:16 am »
Thanks for clarification.

2
General Board / Table containing Tagged Values
« on: August 07, 2024, 06:11:08 pm »
In some older posts I've seen queries operating on t_attribute/t_attributetag when getting tagged values. In my database those are empty, and the tagged values seem to be located in t_objectproperties.

Does anyone know about the reason for this? Was there a change some time?

3
General Board / Re: Get all elements of hierarchy
« on: August 06, 2024, 10:49:26 pm »
In this old version you have to use brackets for multiple JOINs, to avoid confusion of the SQL engine.

4
General Board / Re: Get all elements of hierarchy
« on: August 06, 2024, 09:42:04 pm »
Code: [Select]
SELECT
CLASSGUID = o.ea_guid
,CLASSTYPE = o.object_type
    , o.*
FROM ((((t_package AS p0
LEFT JOIN t_package AS p1 ON p1.Parent_ID = p0.Package_ID)
LEFT JOIN t_package AS p2 ON p2.Parent_ID = p1.Package_ID)
LEFT JOIN t_package AS p3 ON p3.Parent_ID = p2.Package_ID)
INNER JOIN t_object AS o on o.Package_ID in (p0.Package_ID, p1.Package_ID, p2.Package_ID, p3.Package_ID))
WHERE 1=1
AND p0.Package_ID = <number>

Thanks. In EA14 this does not work, EA reports a redundant bracket "(".

5
General Board / Re: Get all elements of hierarchy
« on: August 06, 2024, 03:41:46 pm »
LEFT JOIN t_object o ON (o.Package_ID = p0.Package_ID or o.package_ID = p1.Package_ID or...)
I already tried that, this gives me a syntax error in EA14.

Thanks for your support!

6
General Board / Re: Get all elements of hierarchy
« on: August 06, 2024, 04:35:49 am »
You can definitely use IN in a join. I'm not sure which database you are working with, but if the IN doesn't work, you can replace that with OR's.

When I replace X with 0,1,2,3 it seems to work for each individual level. Any ideas how to achieve this in one query?

Code: [Select]
SELECT *
FROM ((((t_package p0
LEFT JOIN t_package p1 ON p1.Parent_ID = p0.Package_ID)
LEFT JOIN t_package p2 ON p2.Parent_ID = p1.Package_ID)
LEFT JOIN t_package p3 ON p3.Parent_ID = p2.Package_ID)
LEFT JOIN t_object o ON o.Package_ID = pX.Package_ID)
WHERE p0.Package_ID = <number>

Edit: 4x UNION seems to do the trick, but I think this is the least elegant solution.

7
General Board / Re: Get all elements of hierarchy
« on: August 06, 2024, 03:40:52 am »
t_object AS p0 should be t_package as p0 I guess.
Of course you're right.

You can definitely use IN in a join. I'm not sure which database you are working with, but if the IN doesn't work, you can replace that with OR's.
What is the goal of your last INNER JOIN, is the IN statement a shortcut to perform a JOIN 4x? Or JOIN once, and filter results?

Btw, INNER JOIN doesn't seem to work here ("expression not supported"). LEFT JOIN seems to bypass this.

8
General Board / Re: Get all elements of hierarchy
« on: August 05, 2024, 11:41:40 pm »
So in total, this would read:
Code: [Select]
SELECT *
FROM ((((t_object AS p0
LEFT JOIN t_package AS p1 ON p1.Parent_ID = p0.Package_ID)
LEFT JOIN t_package AS p2 ON p2.Parent_ID = p1.Package_ID)
LEFT JOIN t_package AS p3 ON p3.Parent_ID = p2.Package_ID)
INNER JOIN t_object AS o on o.Package_ID in (p0.Package_ID, p1.Package_ID, p2.Package_ID, p3.Package_ID))
WHERE p0.Package_ID = <number>

I get a syntax error on that one? I am not so sure if IN can be used within JOIN?

9
General Board / Get all elements of hierarchy
« on: August 05, 2024, 10:46:05 pm »
Dear all, I try to accomplish the following:
* I want to write an SQL query returning all elements (e.g. requirements, classes, blocks) of a package hierarchy
* The only parameter is the Package_ID of the "root" node
* No recursion mechanisms, no macros
* The number of levels to go down the hierarchy can be fixed and set to e.g. 3

My current idea was to use t_object and join t_package multiple times and get the elements. But it doesn't work yet.

Code: [Select]
SELECT *
FROM ((((t_object AS o
INNER JOIN t_package AS p0 ON o.Package_ID = p0.Package_ID)
LEFT JOIN t_package AS p1 ON p1.Parent_ID = p0.Package_ID)
LEFT JOIN t_package AS p2 ON p2.Parent_ID = p1.Package_ID)
LEFT JOIN t_package AS p3 ON p3.Parent_ID = p2.Package_ID)
WHERE p0.Package_ID = <number>

Any ideas what's missing and how to realize this?


10
General Board / Re: Limiting "Model Search" to package?
« on: August 01, 2024, 11:58:52 pm »
#Branch=<GUID># sounds interesting. Unfortunately it yields a syntax error and I suspect that Branch with this GUID parameter is not available in EA14, only #Branch# seems to work.

11
General Board / Re: Limiting "Model Search" to package?
« on: August 01, 2024, 08:58:48 pm »
The drawback of those solutions is that it is difficult to execute them in scope of a relationship matrix, as I always have to select the required package first.

I'd prefer a solution where I first query a specific package, and then get all elements of that package (and subpackages).

12
General Board / Limiting "Model Search" to package?
« on: August 01, 2024, 07:03:57 pm »
Is there an easy possibility to limit the model search to one package? i.e. I want to get all elements of a certain stereotype within one package and its subpackages

Thanks

13
+1

14
General Board / Re: Relationship matrix with multiple packages
« on: July 09, 2024, 04:23:20 pm »
selecting hierarchy in matrix
Where exactly can I find this?

15
General Board / Relationship matrix with multiple packages
« on: July 09, 2024, 03:52:05 am »
Hi,
Is it somehow possible to create a relationship matrix in EA which uses a group of packages as source for elements? (to view in the matrix against the target elements)
My initial idea was to create a special SQL query or use the query editor, but until now I was not able to come up with a solution.
Thanks
Martin

Pages: [1] 2 3 4