Book a Demo

Author Topic: t_diagramlink Issue when automating Connector creation  (Read 13229 times)

ejafman

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
t_diagramlink Issue when automating Connector creation
« on: April 18, 2026, 12:21:02 am »
Hi all...can't seem to figure this one out.

I run the exact code in the vbscript example outlines to create a new "Association" connector between two elements within my model.

My test diagram actually shows the connector named "test link 2".

When running the following sql to get the "links" on the diagram, the newly created connector is not in t_diagramlinks:
Code: [Select]
select  dl.*
from    t_diagram diag,
        t_diagramlinks dl
where   diag.Diagram_ID = dl.DiagramID
and     diag.ea_guid in ('{81D3FBA1-4F3F-4141-88C6-4CDACBB8DEB0}')

Anyone have any clues? Our modelers work within the diagram space, and do import/export work based upon information exported via code which creates a s/s based on diagram visibility, so this newly created connector will not be included in the report.

Thanks in advance...Eric

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: t_diagramlink Issue when automating Connector creation
« Reply #1 on: April 18, 2026, 12:52:23 am »
Diagramlinks are not automatically created for each new connector.
This happens only when the diagram is opened.

So your query should be: all relations between all tuples of elements shown on the diagram, minus the relations that are hidden in the diagram (diagramLink.Hidden = 1)

Geert

ejafman

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: t_diagramlink Issue when automating Connector creation
« Reply #2 on: April 18, 2026, 01:15:59 am »
You DA MAN!

My "real" SQL driver for the export of "connectors" is this:
Code: [Select]
select  rel.ea_guid
from    t_diagram diag,
        t_diagramlinks dl,
        t_connector rel,
        t_diagramobjects sdo,
        t_diagramobjects edo
where   diag.Diagram_ID = dl.DiagramID
and     diag.Diagram_ID = sdo.Diagram_ID
and     diag.Diagram_ID = edo.Diagram_ID
and     instr(diag.PDATA, 'HideRel=1') = 0
and     dl.ConnectorID = rel.Connector_ID
and     rel.Start_Object_ID = sdo.Object_ID
and     rel.End_Object_ID = edo.Object_ID
and     dl.Hidden = 0
and     rel.Connector_Type in ('Aggregation', 'Association', 'Generalization')
and     diag.ea_guid in ('{81D3FBA1-4F3F-4141-88C6-4CDACBB8DEB0}')

Guess I have to tweak the code to find all diagrams that have both classes, and force a save. Saving the diagram seems to be the only way to make it "stick"

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: t_diagramlink Issue when automating Connector creation
« Reply #3 on: April 18, 2026, 06:00:17 pm »
No, you don't.

Simply change your query.

Select all relations between all elements that are both on your diagram, and where not exists a diagramlink with hidden = 1

Geert

ejafman

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: t_diagramlink Issue when automating Connector creation
« Reply #4 on: April 22, 2026, 09:45:19 pm »
True...I should have said "Tweak the code to generate the "new" query" ;)

split it into a union, with a not exists on the second part, works like a charm. Thanks again.
Learning something new every day.

Code: [Select]
select  rel.ea_guid
from    t_diagram diag,
        t_connector rel,
        t_diagramobjects sdo,
        t_diagramobjects edo
where   diag.Diagram_ID = sdo.Diagram_ID
and     diag.Diagram_ID = edo.Diagram_ID
and     instr(diag.PDATA, 'HideRel=1') = 0
and     rel.Start_Object_ID = sdo.Object_ID
and     rel.End_Object_ID = edo.Object_ID
and     rel.Connector_Type in ('Aggregation', 'Association', 'Generalization')
and not exists
          (select  1
          from     t_diagramlinks dl
          where    dl.ConnectorID = rel.Connector_ID)
and     diag.ea_guid in ('{36E4628C-768D-4919-B4D7-21ED246020F6}','{5EE6C77A-1109-48c6-A999-BA8221668F71}')
UNION
select  rel.ea_guid
from    t_diagram diag,
        t_diagramlinks dl,
        t_connector rel,
        t_diagramobjects sdo,
        t_diagramobjects edo
where   diag.Diagram_ID = dl.DiagramID
and     diag.Diagram_ID = sdo.Diagram_ID
and     diag.Diagram_ID = edo.Diagram_ID
and     instr(diag.PDATA, 'HideRel=1') = 0
and     dl.ConnectorID = rel.Connector_ID
and     rel.Start_Object_ID = sdo.Object_ID
and     rel.End_Object_ID = edo.Object_ID
and     dl.Hidden = 0
and     rel.Connector_Type in ('Aggregation', 'Association', 'Generalization')
and     diag.ea_guid in ('{36E4628C-768D-4919-B4D7-21ED246020F6}','{5EE6C77A-1109-48c6-A999-BA8221668F71}')