It's possible to draw if/else/endif without merge symbol?

+10 votes
asked Nov 30, 2015 in Wanted features by dd (160 points)
edited Dec 2, 2015 by dd
Hi,
 
  It's possible to draw if/else/endif without merge symbol in Activity Diagram (beta) like if/else/elseif/endif?
  In big diagrams the merge symbol takes a lot of space.
 
  Exist diagram:
 
  
  Desired diagram:
 
 
 
@startuml
:Enter;
if (Condition 0?) then (yes)
:Action 0]
else (no)
if (Condition 1?) then (yes)
if (Condition 2?) then (yes)
:Action 1]
else (no)
:Action 2]
endif
else (no)
:Action 3]
endif
endif
:Exit;
@enduml
 
Best regards,
dd
commented Mar 28, 2016 by caro0071 (100 points)
Bump.  I have the same question.  I have four nested if statements which results in a muddy end to the diagram.  Is it possible to do this?
commented Jun 20, 2016 by AcceptSocket (120 points)
I want this feature too. It will be nice to be able to suppress the merge symbol.

3 Answers

0 votes
answered Dec 1, 2015 by pacheco (380 points)

I cannot see your diagrams...

But if I understand your question, use the keyword "detach" to stop drawing further on that branch wink

commented Dec 2, 2015 by dd (160 points)
Hi,

  I updated image of diagrams.
  Did you see diagrams?

  Keyword "detach" removes arrows and all further a flow.

  I need to remove only "merge symbol".

Best regards,
dd
commented Dec 2, 2015 by pacheco (380 points)
use "elseif" notation and you get a similar effect on bottom (also affects the top part):

http://plantuml.com/imgp/activity2_004.png
commented Dec 3, 2015 by dd (160 points)
I need use exactly "if/else/endif" without "elseif", because between two conditions "if/else/endif" may be activitys (actions).
commented Mar 28, 2016 by caro0071 (100 points)
I'm having the same issue.  The "elseif" notation is what i want, but I can't add intermediate activities between the conditionals.  Maybe it's possible to label the arrow between conditionals?  If so that could help, but ideally all "endif" merges would consolidate to a single line unless otherwise required by an intermediate activity.
0 votes
answered Oct 10, 2017 by Dresaan (400 points)

I'm looking for the same result. I have the following code part:

if (Question 1) then
    :Do something|
    if (Question 2) then
        :Do something else|
    endif
endif
:Finish something;

This produces the following diagram:

 

I would like to merge the endifs at the end. One of them would fit my needs.

Is it posible to maybe add an option or alternate endif which tries to merge if another endif is following?

commented Feb 16, 2019 by Nathan
Yes, this empty diamond is really annoying:
@startuml
start
if (condition A) then (yes)
  :Text 1;
else (nothing)
  :Text else;
endif
stop
@enduml
0 votes
answered Jun 2, 2019 by jbuhacoff (180 points)

We should have a ConditionEndStyle skin param to render endif as a diamond or horizontal line:

skinparam ConditionEndStyle diamond (default)
skinparam ConditionEndStyle hline (new option)

Example with two branches:

@startuml
skinparam ConditionEndStyle hline
:A;
if (decision) then (yes)
    :B1;
else (no)
    :B2;
endif
:C;
@enduml

PlantUML new skin param ConditionEndStyle hline with two branches

Example with one branch:

@startuml
skinparam ConditionEndStyle hline
:A;
if (decision) then (yes)
    :B1;
else (no)
endif
:C;
@enduml

PlantUML new skin param ConditionEndStyle hline with one branch

I implemented this and submitted a pull request https://github.com/plantuml/plantuml/pull/209 on GitHub. 

commented Jun 7, 2019 by jbuhacoff (180 points)
The pull request was accepted by @arnaudroques (thanks!) and now what is remaining is to be able to merge multiple nested endifs to one diamond or one horizontal line.
...