Book a Demo

Author Topic: Hyperlink to element in diagram  (Read 6399 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Hyperlink to element in diagram
« on: May 04, 2017, 06:58:56 pm »
Hi all,

Is there a way to create an in-EA hyperlink which opens a diagram and selects a specific element in it?

Cheers,


/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Hyperlink to element in diagram
« Reply #1 on: May 04, 2017, 09:48:27 pm »
Doesn't seem so. There are tons of "EA Commands" available. But not a single one that triggers a script :-/

q.

VKN

  • EA User
  • **
  • Posts: 187
  • Karma: +9/-1
    • View Profile
Re: Hyperlink to element in diagram
« Reply #2 on: May 05, 2017, 10:07:36 am »
Yes.
Create a Hyperlink element on a diagram.
On the Hyperlink Details dialog select EA Command for Type.
Then select ElementUsage in the following drop down.
Enter the Alias value of your target element.
Double click on the hyperlink to open the diagram with the target element selected.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8617
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Hyperlink to element in diagram
« Reply #3 on: May 05, 2017, 12:50:53 pm »
Yes.
Create a Hyperlink element on a diagram.
On the Hyperlink Details dialog select EA Command for Type.
Then select ElementUsage in the following drop down.
Enter the Alias value of your target element.
Double click on the hyperlink to open the diagram with the target element selected.
Sounds interesting, but what if your element doesn't have an Alias?

Paolo

[Edit: Didn't work for me - even with an Alias set...]
« Last Edit: May 05, 2017, 12:56:20 pm by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

VKN

  • EA User
  • **
  • Posts: 187
  • Karma: +9/-1
    • View Profile
Re: Hyperlink to element in diagram
« Reply #4 on: May 05, 2017, 01:39:54 pm »
[Didn't work for me - even with an Alias set...]
Check to see if you've missed any of the steps otherwise try again.
Worked for me.
Also try right-clicking on the hyperlink element then select Advanced | Execute Link
« Last Edit: May 05, 2017, 02:46:51 pm by VKN »

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Hyperlink to element in diagram
« Reply #5 on: May 05, 2017, 02:21:00 pm »
Enter the Name or Alias of your target element in the hyperlink's Notes field.

I had never seen this functionality before now so I don't know what happens if there is more than one element with the same name or alias, or if the element appears on more than one diagram. That can be left as an exercise for the reader... ;)
The Sparx Team
[email protected]

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8617
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Hyperlink to element in diagram
« Reply #6 on: May 05, 2017, 05:03:16 pm »
Enter the Name or Alias of your target element in the hyperlink's Notes field.

I had never seen this functionality before now so I don't know what happens if there is more than one element with the same name or alias, or if the element appears on more than one diagram. That can be left as an exercise for the reader... ;)
Still not working...  The item is only in one diagram and only one instance in the repository.
Looking at the t_object entry, there doesn't seem to be enough stuff to do what we want.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Hyperlink to element in diagram
« Reply #7 on: May 05, 2017, 06:43:39 pm »
Well, it's a bit weird.

I got it to work by putting the target's Alias in the hyperlink's Notes.
Then when I cleared the Notes field, the link still worked. Which it shouldn't at that point.

The link is actually named "$uicmd=MenuCmd;param1=ElementUsage;param2=", so I tried putting the target GUID into the name as param2, and that also worked once, but then I fiddled with some stuff and it stopped working.
So there's something going on, something's getting cached or stored in the elephants' graveyard t_xref or something. On the plus side, GUIDs work, so you can make the reference unambiguous.

At the end of the day what this does is call good ol' element usage, aka Find in Diagrams. If the referenced element exists in one diagram, that diagram is opened and the element is selected; if the referenced element (or instances of it) is present in more than one diagram, you get a selection dialog.

In the OP I omitted that I wanted this in a hyperlink in a Notes field, not a standalone one. I tried it in the context of a Notes field, but there is then no way to access the details of the hyperlink.
So while you can create an EA Command / Element Usage hyperlink in a Notes field, when you click it, you get element usage for the element whose Notes field the link is in. Also, it only works once and then the link is vaporized. Single-use hyperlinks -- what a concept. 8)

So functionally, this would be close enough for my needs. However, the stability issues make me wary of using it.

Thanks all for your efforts.


/Uffe
My theories are always correct, just apply them to the right reality.