Book a Demo

Author Topic: Create a diagram hyperlink from a script  (Read 5716 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Create a diagram hyperlink from a script
« on: July 09, 2014, 05:56:02 pm »
Hi,

I'm working on a diagram script in which I'm updating the current diagram to add hyperlinks to diagrams that I've gathered in an array.

I'm looking for an example to generate those hyperlinks on the diagram, by using I suppose the DiagramObjects.AddNew method.

Thanks,
« Last Edit: July 09, 2014, 05:57:32 pm by gfuk »
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Create a diagram hyperlink from a script
« Reply #1 on: July 09, 2014, 07:36:12 pm »
I'm of-site currently. So out of my head: you need to create a note element and assign some magic to it. You can find out that by creating an empty EAP, adding a note and a hyperlink and run a search on t_object to see the difference between simple note and hyperlink.

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Create a diagram hyperlink from a script
« Reply #2 on: July 09, 2014, 07:48:55 pm »
Hi,

I eventually figured it out.
A text element needs to be created, its notes populated with the text to displayed on the diagram, and a SQL UPDATE must be run to set PDATA1 to the DiagramID .

e.g. in VB :
Dim hyperlink
set hyperlink = currentPackage.elements.AddNew ("","Text")
hyperlink.Notes = "Go back to " & Repository.GetDiagramByID(diagID).Name
hyperlink.Update
sql = "UPDATE t_object SET PDATA1='" & diagID & "' WHERE ea_guid = '" & hyperlink.ElementGUID & "'"
Repository.Execute (sql)


Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Create a diagram hyperlink from a script
« Reply #3 on: July 09, 2014, 08:15:55 pm »
Glad you found it. And of course it's a text element, not a note  :)

q.