Is there a way to refer to an existing Activity inside a ActivityDiagram (goto)

+6 votes
asked Feb 20, 2014 in Wanted features by micatom (120 points)
retagged Sep 18, 2015 by plantuml
Hello guys,

I just wanted to know if there is a way to refer from an outgoing action of an Activity to another alreay existing Activity (like a goto feature)

If not is it planned to be ?

Thx,

Michaël.

--

 

@startuml

start

:User Data Form << View >>;
if (email exists) then (yes)
 goto :User Data Form << View >>;
else
 :User Presentation Form << View >>;
endif

stop

@enduml

2 Answers

+4 votes
answered Mar 6, 2014 by arnaud.bourree (140 points)

Hello,

I'm not specially for goto keywork but, I personaly need possibility to simplify Activity2 like:

@startuml
start
if (condition1?) then (yes)
  :action1;
  if (condition2?) then (yes)
    :action2;
  else
    :actionKO;
  endif
else (no)
  :actionKO;
endif
@enduml

from 2 action KO to something like only one action KO

Regards,

Arnaud

+4 votes
answered Aug 24, 2014 by plantuml (294,960 points)

Goto is one of the most asked feature, so we have decided to give a try.
The real issue with goto is that it is breaking the execution flow, and this is completely incompatible
with the way Activity Diagram are drawn.

However, nothing is ever impossible to do...

So starting with V8004, we have implemented a pre-alpha goto feature.
You can now use label/goto keywords to use goto feature:

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


http://www.plantuml.com/plantuml/png/BOf12e0m30JlUKMEUgnwQbwZkDL2R8Ja_rZHopBCR2vcIKZN3Sfz4-Lk9g5QU72xm06FaUD48-OtpjBXiB3l3tNyPH52ssiX3xiV

However, again, this is only pre-alpha software : the drawing is ugly (line in green), goto are only working backwards,
this is not working with swimlanes...

We need users help for two things:
1) We want to validate that everyone is ok with the syntax
2) More important, we are very interested by real diagrams from end users : this will indeed help us to build the design
of the solution for goto. So please either publish here (or send us by mail) the text diagram you wanted to see working
(even if it's not working with the V8004 version). We are waiting for real diagrams, large enough to be realistic.

Thanks for you help!
 

commented Dec 3, 2014 by Jerome2606 (100 points)
edited Dec 3, 2014 by Jerome2606
something like the sample with menu choosen on http://msdn.microsoft.com/en-us/library/dd409465.aspx
And this is a diagram like we want to achieve with plantUML:
http://sce.uhcl.edu/helm/rationalunifiedprocess/process/modguide/md_bactdbom.htm
Finally here is a diagram from formation:
http://www.filedropper.com/slides-efficientbusinessanalysistrainingprogram-escent
commented Mar 10, 2015 by Jerome2606 (100 points)
Hello,

Is there any update for this most asked feature ?

Regards,
J
commented Jun 17, 2015 by anonymous
Hi,

I would need the goto to have the possibility to go back upwords if an error occurs

Is there anything I can help to improve the goto functionality?

Regards
commented Nov 24, 2016 by IanRogers (150 points)
General "goto" is always going to be a pain to implement and won't really reflect real code anyway... The "break" out of a loop(s) is much more useful.
commented Dec 11, 2018 by Nica MLG
Instead of

label X
..
goto X

Why not using "as" keyword and arrows?

:act1;
:"Act 2" as label1;
..
..
if (contidion) then (No)
 :Decision 23;
 ->:label1
endif
:Next, please;

Using -> together with : before the alias to keep the semantics. Or something clearer.
Of course, a simple goto label1 could also be added, but in most cases, this approach would be enough. The old activity already does so when many activities point to the same activity name, right?
commented Nov 18, 2019 by Steve B.
Would also be possible to put an activity on that goto/return line?

I'm working through a process where I would like to do something like:

label Ticket
:Open Ticket;
:Review Ticket;
if (Submission Complete) then (no)
  return to Ticket
    :Assign Ticket to Originator;
    :Update Ticket;
  endreturn
else (yes)
endif
:Process Ticket
commented Jan 27, 2021 by alexaiezza (100 points)

Unfortunately, this doesn't seem to help me still.

The closest I was able to get was to use break to just disconnect the if logic branch that I wanted to actually continue to the next item.

This is what I'm aiming for.

This is as close as I'm able to get by hacking around with the repeat keyword.

commented Mar 20, 2021 by TS

I want to do something similar but real simple - just a flowchart of "A or B" but it just doesn't completely connect the goto line. Some variations on this cause java exception with stack trace, but this is how I'd like to write the code

if (A) then (yes)
 goto success
else (no)
  if (B) then (yes)
    label success
    :A or B;
  else (no)
  endif
endif


     |
    / \
  <  A  >--yes------->
    \ /              |
     | no            |
     |               |
    / \          +--------+
  <  B  >--yes-->| A or B |
    \ /          +--------+
     | no            |
     |<--------------'

  

Unfortunately this doesn't work. I can kind of get this using the old style but don't like the layout because the layout is messier than it should be. (also it would be great if there were a skin parameter for making true go right and false go down)
 

...