Author Topic: What does the Package_ID in t_object represent?  (Read 2199 times)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1145
  • Karma: +30/-8
    • View Profile
What does the Package_ID in t_object represent?
« on: July 17, 2025, 01:41:49 am »
I am not sure if this is dumb question, but let's assume I have the following package structure:

A [Package]
-->A100 [Package]
---->A120 [Object]
B [Package]
-->B100 [Package]
---->B110 [Object]

Sparx EA stores the data for the above structure twice on in t_object and again in t_package; nothing new here.

I am interested in 2 columns from t_object, object_id and package_id, and one from t_package, package_id, and their relationships.

Looking, at the results from various queries
> If the object is a package, t_object.package_id is the identifier of the parent package - e.g. for A100 it is the package identifier of package A, but
> If the object is not a package, it is the identifier of the package where the object is located - e.g., for B110 it is identifier of package B100.

Have I misunderstood something? I guess in both cases it is the identifier of the container package.

The reason for the question is that I am trying to understand what the #Package# and #Branch# macros pass as their parameters. The package_id from t_package, the object_id from t_object, or the package_id from t_object.



Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: What does the Package_ID in t_object represent?
« Reply #1 on: July 17, 2025, 11:42:12 am »
I guess in both cases it is the identifier of the container package.
Yes.

The reason for the question is that I am trying to understand what the #Package# and #Branch# macros pass as their parameters. The package_id from t_package, the object_id from t_object, or the package_id from t_object.
Package_ID = #Package# or Package_ID in (#Branch#)

Only #Branch# has any kind of parameter and it takes the id or guid of the root package when you want that explicitly specified instead of using the currently selected package.

Quote
There are three permutations of this macro:
    in #Branch# - gets the ID of each child Package of the parent Package selected by the user
    in #Branch=<GUID># or #Branch=<ID># - gets the ID of each child Package of the parent Package specified by the GUID or ID
    in #Branch=<ID>,<ID>,<ID># - gets the ID of each child Package under each parent Package specified by its ID
« Last Edit: July 17, 2025, 11:48:33 am by Eve »

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1145
  • Karma: +30/-8
    • View Profile
Re: What does the Package_ID in t_object represent?
« Reply #2 on: July 17, 2025, 06:37:45 pm »
Thank you Eve, did I understand this correctly?

Package_ID = #Package#

Uses the ID of the current package.

Quote
There are three permutations of this macro:
    in #Branch# - gets the ID of each child Package of the parent Package selected by the user
    in #Branch=<GUID># or #Branch=<ID># - gets the ID of each child Package of the parent Package specified by the GUID or ID
    in #Branch=<ID>,<ID>,<ID># - gets the ID of each child Package under each parent Package specified by its ID
Using the example in the previous post, I would greatly appreciate if could you please define "child Package of the parent Package"?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: What does the Package_ID in t_object represent?
« Reply #3 on: July 21, 2025, 09:14:09 am »
If you have A selected (or specify its id/guid):
  • t_object.Package_ID = #Package# will give you A100 only
  • t_object.Package_ID in (#Branch#) will give you A100 and A120

Look at any package in your browser:
  • t_object.Package_ID = #Package# will give you the immediate children
  • t_object.Package_ID in (#Branch#) will give you everything you get using an expand branch (or *)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1145
  • Karma: +30/-8
    • View Profile
Re: What does the Package_ID in t_object represent?
« Reply #4 on: July 28, 2025, 10:53:37 pm »
Thank you Eve. Just one quick clarification regarding
If you have A selected (or specify its id/guid):
  • t_object.Package_ID = #Package# will give you A100 only
  • t_object.Package_ID in (#Branch#) will give you A100 and A120
Does that behaviour apply irrespective of the object type? Does the same behaviour apply to a child object of a type package or a type class - i.e., does the same behaviour apply irrespective of whether A120 is a package or a class?