Book a Demo

Author Topic: Hide PK and FK labels from connectors  (Read 4293 times)

PKHiQ

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Hide PK and FK labels from connectors
« on: July 31, 2014, 07:06:57 pm »
I would like to hide the PK and FK labels but leave the (columnX=columnY) -definition to the connector.

I can hide all the PK and FK labels by hand, but I have a data model which consists of over 100+ tables, so this is time consuming.

Can this be done automatically?
This
Diagram -> properties -> Connectors -> Suppress All Connector Labels
takes away the ColumnX = ColumnY -text which I would like to keep...
« Last Edit: July 31, 2014, 07:09:02 pm by PKHiQ »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Hide PK and FK labels from connectors
« Reply #1 on: July 31, 2014, 08:25:44 pm »
The only way would be to write a script to assist you in doing that.

q.

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
Re: Hide PK and FK labels from connectors
« Reply #2 on: November 20, 2018, 09:05:57 am »
I would like to hide the PK and FK labels but leave the (columnX=columnY) -definition to the connector.

I can hide all the PK and FK labels by hand, but I have a data model which consists of over 100+ tables, so this is time consuming.

Can this be done automatically?
This
Diagram -> properties -> Connectors -> Suppress All Connector Labels
takes away the ColumnX = ColumnY -text which I would like to keep...
gosh bump
Orthogonality rules
Position and Team disestablished, thanks austerity.
Now itinerant.

rupertkiwi

  • EA User
  • **
  • Posts: 133
  • Karma: +5/-0
    • View Profile
Re: Hide PK and FK labels from connectors
« Reply #3 on: December 04, 2018, 12:01:44 pm »
This script will hide or show all lable son a diagram. I havent used it on a data model but it could be apadted possibly:


option explicit

!INC Local Scripts.EAConstants-VBScript

' Script Name: LabelVisibility
' Author: Rupert Ryan
' Purpose: Changes label visibility across all diagram objects
' Date: 19/02/2018
'
Dim LLB 'Label Left (source) Bottom Source Role
Dim LLT 'Label Left (source) Top Source Multiplicity
Dim LMT 'Label Middle Top Name
Dim LMB 'Label Middle Bottom Stereotype
Dim LRT 'Label Right (dest) Top Dest Role
Dim LRB 'Label Right (dest) Bottom Dest Multiplicity
Dim IRHS 'Information Flows realized (dest)
Dim ILHS 'Information Flows realized (source)

LLB = 1
LLT = 0
LMT = 1
LMB = 1
LRT = 1
LRB = 1
IRHS = 1
ILHS = 1

dim geometryupdate
Dim hidden

Sub diagramconnector()
    Dim currentDiagram
    Set currentDiagram = repository.GetCurrentDiagram()
   Dim diagramlink
   Dim j
    Dim diagramlinks As EA.Collection
   Dim dirty
   dirty = false
   If currentDiagram.diagramlinks.Count > 0 Then
      For j = 0 To currentDiagram.diagramlinks.Count - 1
         Set diagramlink = currentDiagram.diagramlinks.GetAt(j)
         labellist (diagramlink.geometry)
         diagramlink.geometry = geometryupdate
         diagramlink.Update
         dirty = true
      Next
   End If
   if dirty then
      repository.ReloadDiagram currentDiagram.DiagramID
   end if
End Sub

Sub labellist(geometry)
    Dim strArray
    Dim intCount
    strArray = Split(geometry, ";")
    For intCount = LBound(strArray) To UBound(strArray)
    hidden = InStr(1, Trim(strArray(intCount)), "HDN")
      If Not hidden = 0 Then
         strArray(intCount) = labelhide(Trim(strArray(intCount)),hidden)
         geometryupdate = Join(strArray, ";")
      Else
      End If
   Next
End Sub

Function labelhide(label,hidden)
    Dim strArray
    Dim intCount
    strArray = Split(label, ":")
   Dim toggle
    toggle = Mid(label, hidden + 4, 1)
    Select Case Mid(strArray(0), 1, 4)
        Case "$LLB"
         toggle = LLB
        Case "LLT="
            toggle = LLT
        Case "LMT="
            toggle = LMT
        Case "LMB="
            toggle = LMB
        Case "LRT="
            toggle = LRT
        Case "LRB="
            toggle = LRB
        Case "IRHS"
            toggle = IRHS
        Case "ILHS"
            toggle = ILHS
    End Select
labelhide = replace(label, Mid(label, hidden + 4, 1), toggle)
End Function
diagramconnector




Just save it as a script under the 'Diagrams' folder in the Scripting window and run it on a diagram.

Cheers,
Rupert