Author Topic: How to get the base port element of an inherited port via automation API?  (Read 3177 times)

heba

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Hi,

I need some help to figure out how to get the base port element - id or guid - (or whatever helps) of an inherited port element.

I have no idea how to attach screenshots here so let me describe what I did:
 - Create a class with a port
 - Create a part and set the type to that class
The part now inherits the port. In diagrams it can be made visible by checking "Show owned/inherited".  Now it seems that this inherit port gets an individual GUID in the model.

After connecting several of these "parts" I can access connector properties (ClientId, SupplierId) to get to the port element. This always returns the individual GUID of the derived port of the part.  What I need is the base port element - id or guid - doesn't matter.

Is there any property or method how to get it? Tried with Element class but no success for now.

Only solution so far is to get PDATA3 column value via SQL query, e.g. "select PDATA3 from t_object where Object_ID=<inherited port id>" but it makes no sense to do that if I have a "clean" API.

Any ideas?

-Heiko


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to get the base port element of an inherited port via automation API?
« Reply #1 on: December 09, 2023, 07:05:35 pm »
Pdata = EA.Element.MiscData

Geert

heba

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: How to get the base port element of an inherited port via automation API?
« Reply #2 on: December 09, 2023, 08:45:08 pm »
That's it, thank you!  -> MiscData[2] contains the string from the database or an empty string if the value is empty.

I really wonder why this is hidden so well and not worth a dedicated method/property at the EA Element. I wasn't even able to see this MiscData property in Visual Studio Debugger.  ???

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to get the base port element of an inherited port via automation API?
« Reply #3 on: December 09, 2023, 11:59:05 pm »
I really wonder why this is hidden so well and not worth a dedicated method/property at the EA Element. I wasn't even able to see this MiscData property in Visual Studio Debugger.  ???

The API is not much more than a thin layer on top of the database.
That's why a lot of us have build a whole wrapper library on top of the API that works in a more functional way.

Geert