Activity branching into three options

0 votes
asked Oct 5, 2018 in Question / help by Peter

Hello all,

I am failing in including a third option as an activity branch; I have highlighted the part below:

Any help is much appreciated.

@startuml


start

-Booking

if (broker) then (yes)
  :status = <b>requested;
  
  if (cancelled by infoline/customer) then (yes)
    :status = <b>paused;
    stop
  else (no)
    if (confirmed by mail) then (yes)
      :status = <b>billed;
      stop
    else (no)
      if (confirmed by updater) then (yes)
        :status = <b>billed;
        stop
      else (no)
        :status = <b>requested;
        stop
      endif
    endif
  endif
    
else (no)
  :status = <b>new;
  if (cancelled by infoline/customer) then (yes)
    :status = <b>cancelled;
    stop
  else (no)
    if (confirmed by cronjob) then (yes)
      :status = <b>billed;
      stop
    else (no)
      if (email from broker) then (confirmation)
        :status = <b>billed;
        stop
      else (rejection)
        :status = <b>cancelled;
        stop

      else (no reply)

        :status = <b>new;

        stop

      endif
   endif
   endif

endif

@enduml

1 Answer

0 votes
answered Oct 6, 2018 by albert (3,520 points)
 
Best answer

I think you want to have an else if construct:

Something like:

else if (email with rejection from broker) then(rejection)

instead of

else (rejection)

so something like:

@startuml
start

-Booking

if (broker) then (yes)
  :status = <b>requested;
 
  if (cancelled by infoline/customer) then (yes)
    :status = <b>paused;
    stop
  else (no)
    if (confirmed by mail) then (yes)
      :status = <b>billed;
      stop
    else (no)
      if (confirmed by updater) then (yes)
        :status = <b>billed;
        stop
      else (no)
        :status = <b>requested;
        stop
      endif
    endif
  endif
    
else (no)
  :status = <b>new;
  if (cancelled by infoline/customer) then (yes)
    :status = <b>cancelled;
    stop
  else (no)
    if (confirmed by cronjob) then (yes)
      :status = <b>billed;
      stop
    else (no)
      if (email from broker) then (confirmation)
        :status = <b>billed;
        stop
      else if (email with rejection from broker) then(rejection)
        :status = <b>cancelled;
        stop

      else (no reply)

        :status = <b>new;

        stop

      endif
    endif
  endif

endif
@enduml

commented Oct 6, 2018 by Peter
That works as a workaround, thanks Albert!
I hope that the option to have an activity splitting into three branches will be added though...
commented Oct 6, 2018 by albert (3,520 points)
Other possibility I can think of is using a "case/switch"  statement, see e.g http://plantuml.com/activity-diagram-beta part about SDL.
...