Search code examples
javascriptautomationenterprise-architectsupplier

How to find a Notelink, in EA automation, that links a Note to a Connector (and note to an Element)


I have an Enterprise Architect diagram with a Note linked (link L2) to a Connector (link L1). Using Automation API :

  • myDiagram.diagramLinks actually contains L1, any link to an Element, but definitively not L2 which links to a connector
  • the same, myNote.Connectors provides its connectors to Elements, but not to L1...

    1. How can I process ? Forced to use an SQLQuery ?

    2. I also wonder, once I'll have find L1, how I can determine weither L1.SupplierId is an Element or a Connector ? Thanks !


Solution

  • I looked into that and it appears the linked element has a value in t.object.PDATA4 (which equals EAElement.MiscData(3)) being

    idref=<connId>;
    

    where <connId> is the connector ID which it's linked to. There are as many semicolon separated entries as there as links to connectors.

    Here's my setting:

    enter image description here

    two associations linked to a note. t_connector has two entries with IDs 1 and 2:

    enter image description here

    And now as you can see t_object looks like this:

    enter image description here

    The note (which is linked to the associations) has PDATA with references to the association IDs 1 and 2.

    While you can read MiscData through the API it is (IIRC) r/o. In those cases I just fall back to Repository.Execute to run any UPDATE queries.