Is it possible to draw this flow chart in activity diagram?

0 votes
asked Sep 9, 2021 in Question / help by Petty

I want to draw this flow chart with PlantUML. Is it possible?

https://imgur.com/2wX2C0G

How can I achieve [Actoin 1] to [condition B] and [condition C] to [Action 2]?

1 Answer

0 votes
answered Sep 9, 2021 by The-Lu (63,920 points)

Hello P.,

Here is a proposal:

@startuml
|Swimlane1|
|Swimlane2|
|Swimlane3|

start
if (Cond A) then (yes)
  |Swimlane1|
  :A1;
else (no)
endif

|Swimlane3|
if (Cond B) then (yes)
  |Swimlane2|
  :A2;
  kill
else (no)
    if (Cond C) then (yes)
'    |Swimlane2|
    :A2;
    kill
  else (no)
  endif
endif
|Swimlane3|
end
@enduml

Unfortunately, there are 2 Actions 2!

And the hint (use of  'goto', ...) from:

is not yet possible on Swimlane...

If that can help,
Regards.

commented Sep 13, 2022 by jumangee (180 points)

It's possible to use the code and get needed result:

PlantUML Diagram

The problem is in overlapping lines in this case. Current plantuml version have lot of such troubles(((

@startuml
|Swimlane1|
|Swimlane2|
|Swimlane3|

start
if (Cond A) then (yes)
  |Swimlane1|
  :A1;
else (no)
endif

|Swimlane3|
if (Cond B) then (yes)
else (no)
    |Swimlane2|
    if (Cond C) then (yes)
    |Swimlane3|
    end
  else (no)
  endif
endif
  |Swimlane2|
  :A2;

end
@enduml

commented Sep 13, 2022 by The-Lu (63,920 points)

Hello J.,

Here is a proposal, with switching yes/no arrows and adding dummy label, as:

@startuml
|Swimlane1|
|Swimlane2|
|Swimlane3|

start
if (Cond A) then (yes)
  |Swimlane1|
  :A1;
else (no)
endif

|Swimlane3|
if (Cond B) then (yes)
else (no)
    |Swimlane2|
    if (Cond C) then (no)
    label dummylabel
    |Swimlane3|
    else (yes)
    end
    endif
endif
  |Swimlane2|
  :A2;
end
@enduml

If that can help,
Enjoy...
Regards.

...