2

I want to create an Activity Diagram with PlantUML's new beta syntax.

I've got the basic decision logic diagram, but I'm having trouble trying to add a merge node to merge two execution branches. I want branches A1+ and B1+ to lead to a common activity and then end. Unfortunately I only got to the point of having two different activities with the same name.

Current diagram:

@startuml
'https://plantuml.com/activity-diagram-beta
start
:Some Start Activity;
if (Decision AB?) then (A)
    if (Decision A1/A2?) then (A1)
        if (Decision4 A1+/A1-?) then (A1+)
            :Activity for A1+;
            :Activity_2 for A1+;
            :Activity_3 for A1+;
            :Activity_4 for A1+;
            :**TODO Common Activity for A1+, B1+**;
            stop
        else (A1-)
            :Activity for A1-;
            stop
        endif
    else (A2)
    endif
else (B)
    if (Decision B1/B2?) then (B1)
        if (Decision B1+/B1-?) then (B1+)
            :**TODO Common Activity for A1+, B1+**;
            stop
        else (B1-)
        endif
    else (B2)
    endif
endif
:Common activity for A2, B2, B1-;
stop

@enduml

Render: RenderOfCurrent

Goto/Label workaround attempt

Now, I've tried to solve this with a workaround by using the Goto/Label syntax, but that doesn't really solve the problem. Not only is it ugly, it also breaks the layout, since it draws a line over other elements. With Goto/Label workaround:

@startuml
'https://plantuml.com/activity-diagram-beta
start
:Some Start Activity;
if (Decision AB?) then (A)
    if (Decision A1/A2?) then (A1)
        if (Decision4 A1+/A1-?) then (A1+)
            :Activity for A1+;
            :Activity_2 for A1+;
            :Activity_3 for A1+;
            :Activity_4 for A1+;
            label myLabel
            :**TODO Common Activity for A1+, B1+**;
            stop
        else (A1-)
            :Activity for A1-;
            stop
        endif
    else (A2)
    endif
else (B)
    if (Decision B1/B2?) then (B1)
        if (Decision B1+/B1-?) then (B1+)
            label dummyLabel
            goto myLabel
        else (B1-)
        endif
    else (B2)
    endif
endif
:Common activity for A2, B2, B1-;
stop

@enduml

Render: enter image description here

How do I force PlantUML to create a simple merge node and join the two execution branches leading to a common Activity for A1+ and B1+?

Leprechaun
  • 852
  • 6
  • 25

0 Answers0