Could you add a "goto" feature to activity beta?

+6 votes
asked Sep 18, 2015 in Wanted features by anonymous
retagged Sep 18, 2015 by plantuml
It would be nice to be able to make a jump into any activity diagram activity, especially when trying to visualize the behaviour of old Fortran codes that do not conform to the usual conventions of structural programming.

This could be easiest accomplished with a label and a "goto" command.

1 Answer

0 votes
answered Sep 18, 2015 by plantuml (294,960 points)

Goto is really one on the most asked feature. (See http://plantuml.sourceforge.net/qa/?qa=tag/goto )

As said in http://plantuml.sourceforge.net/qa/?qa=1626/there-refer-existing-activity-inside-activitydiagram-goto it's very difficult to implement some goto feature with the current architecture, because the whole drawing is done with some recursive algorithm, and the goto completely breaks this.

Anyway, we have started to implement an alpha version of goto. It's been working for a while. You can try:

:foo1;
label lab1
:foo2;
if (some test) then
  :foo3;
  goto lab1
else
  :foo4;
endif
stop


Unfortunatly, the drawing is not very good, and it works only with goto going backwards.
Anyway, we are still very interesed with real world examples, so you can translate your old Fortran code to this syntax and send it to us.
It will help us to define a consistent architecture for supporting goto.

Regards,

commented Dec 4, 2015 by anonymous
Hi, the alpha version would be very useful if:

1) the goto line inherited the correct skinparam formatting and
2) The detach command was permitted after both the label and the goto commands (as otherwise the original route continues to an expected end block)

Thanks
commented Jun 13, 2017 by sveinburne (100 points)
This is a good example (in french though). Since a goto use cases seems to always refer to a control block, one fix could be to allow us to write an explicit control block (diamond) which can be referenced with a goto.

example :

<> referenced_diamond
:Some action;

...

goto referenced_diamond

That would allow to either break and exit a loop, break and repeat a loop... But I don't know how easily it is feasible with the current implementation.
http://laurent-audibert.developpez.com/Cours-UML/images/fig6_2.png
commented Sep 19, 2022 by Mark
Hi, I am very happy with the goto-feature added to activity beta. In real-life process mapping, I face very often "nested branching". With [if then] and [label goto] I can match this.
But unfortunatelyv, together with swimlanes the goto-connection is not drawn.
Is there any possibility, to implement [label goto] together with swimlanes?
...