Reference earlier activitiy in activity diagram

+1 vote
asked Nov 12, 2017 in Wanted features by Roderik

I am wondering how I can reference (point to) an activity in an activity diagram.

E.g.:

@startuml
start
:A;
if (Q1) then (yes)
  :B;

  if (Q2) then (yes)
    :D;
  else (no)
    :C;
  endif

else (no)
  :C;
endif
stop
@enduml

Here I want C to be the same activity and not be in the activity diagram twice. Both C states/activities should have an identical continuation so it makes sense to point to the same 'activity balloon'. Is it possible to do this already or do we need some extension to the syntax by defining the activity first and then reference it in the flow? I would love to see an example.

1 Answer

0 votes
answered Nov 14, 2017 by mgrol (1,700 points)

Hi,

that was possible with the legacy activity diagrams but not with the current implementation. IMHO, the change was made in favor of fewer line crossings, but at the expense of duplicate activities.

With the legacy code it would have looked like this:

With this as source code:

@startuml
(*) --> "A"
if "Q1" then
  -->[true] "B"
  if "Q2" then
    -->[true] "D"
    -->(*)
  else
    --> "C"
  endif
else
  --> "C"
endif
--> (*)
@enduml

BR,

Michael

...