Book a Demo

Author Topic: EA Package Hierarchy  (Read 4592 times)

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
EA Package Hierarchy
« on: January 24, 2014, 12:46:42 am »
Hello!

I would like to get a list of package directly owned elements of a package.

When I extract the information by the following expression I get all package's owned elements- but not only the directly owned.
For example-  an Activity under a directly-owned UseCase element.

Code: [Select]
SELECT t_object.Object_ID FROM t_object WHERE t_object.Package_ID=MyPackageID.PackageID;
When I do that like this:

Code: [Select]
SELECT t_object.Object_ID FROM t_object WHERE t_object.ParentID=MyPackageID.PackageID;
I get no elements at all!

Any ideas?
Thanks in advance!
« Last Edit: January 24, 2014, 12:47:50 am by avoda234 »

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: EA Package Hierarchy
« Reply #1 on: January 24, 2014, 01:08:53 am »
Elements in a hierarchy are, of course, all located in the same package. But you're almost there. :)

The element's parent ID is in fact the containing element. If the element is contained directly within the package, ParentID is 0. So to find only elements contained directly within the package:

Code: [Select]
SELECT *
FROM t_object
WHERE t_object.Package_ID = ThePackageIdYoureLookingFor
AND t_object.ParentID = 0

/Uffe
My theories are always correct, just apply them to the right reality.

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: EA Package Hierarchy
« Reply #2 on: January 24, 2014, 01:21:58 am »
Great!

Thanks a lot, Uffe!

motivatedgorilla

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: EA Package Hierarchy
« Reply #3 on: January 31, 2014, 05:24:43 am »
How can I get the package ID for a given package name? For example if I ave packages ABC,DEF,etc how can I find out their package ID. Secondly what if I have 2 or more packages with the same name?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA Package Hierarchy
« Reply #4 on: January 31, 2014, 09:42:57 am »
Code: [Select]
SELECT t_package.Package_ID FROM  t_package WHERE t_package.Name = "..."If you have the package twice you get two records. Then it's up to you to decide...

q.