Activity diagram: combine same box

0 votes
asked Mar 23, 2023 in Question / help by Lode

Hi all,

I have a question for a business process mapping. I am using the activity diagram (new version).

I am creating a decision process for an airline company that needs to decide about delaying or cancelling a flight when there are too little manpower resources. So the result is in the end is to proceed with a flight (maybe with a delay) or to cancel it.

In the process, I have several situations. Multiple lead to proceeding with the flight and multiple lead to cancellation of the flight. The problem is that I can't make the similar results end up in the same box. I have 3 results that lead to 'Assign flight' and 3 results that lead to 'Cancel flight'.

How can I make the same results end up in the same box? You can find my code below.

In the old version of activity mapping, this was very easy. You just had to use the same name of the box. Sadly that gives terrible visuals for this diagram.

I tried the 'goto' option, but this also gives bad visual results.

Thanks in advance for your reply!

Best regards,

Lode
 

@startuml

Title Distribution of open flights cockpit

start

if (Reserves available?) then (Yes)

    :Analyse if reserve\nis suitable;

    if (Suitable reserve\navailable?) then (Yes)

        :Assign flight;

        stop

    else (No)

        :Search for voluntary\nswap flight;

        if (Voluntary\nswap found?) then (Yes)

            :Assign flight;

            stop

        else (No)

            :Request flight operations for CGW;

            if (Request approved?) then (Yes)

                :Send SMS;

                if (Volunteer available?) then (Yes)

                    if (Is volunteer suitable?) then (Yes)

                        :Assign flight;

                        stop

                    else (No)

                        if (Make volunteer suitable\nby delaying flight) then

                            :Assign delayed flight;

                            stop

                        else (No)

                            :Cancel flight;

                            stop

                        endif

                    endif

                else (No)

                    :Cancel flight;

                    stop

                endif

            else (No)

                :Cancel flight;

                stop

            endif

        endif

    endif

else (no)

    :No reserves available;

    :Request flight operations for CGW;

    stop

endif

@enduml

2 Answers

0 votes
answered Mar 24, 2023 by plantuml (295,000 points)

It that case, I would probably suggest the use of connectors.

(Click on the image to see the source)


Does it help?

BTW, since the use of connectors followed with detach is very common, we are wondering if we are not going to add a new syntax:

((A))

In case of double parenthesis, we would put a "double circle" like for stop.

Does it sound like a good idea?

commented Mar 24, 2023 by Lode
Hi,

Thank you for your reply.

The suggested solution is not the one I was hoping for. I would like one box that mentions 'Assign flight' and one box that mentions 'cancel flight'. Now there are still three of each. I want to emphasize that several options can lead to the same result.

Also, the box 'Request flight operations for CGW' is present twice. They should be merged as well, as the steps afterwards are the same.

As mentioned, in the legacy activity diagram this was possible, but you it results in very strange lines because of the complexity of the diagram.

Best regards,

Lode
commented Mar 24, 2023 by plantuml (295,000 points)

Not sure you will like the modified version :-)

Still, it's pretty clear to me:

  • There is one box with mention "Assign flight"
  • We clearly see that several options can lead to the same result
Unfortunately, the new version of activity diagram sticks to the execution flow of what would do an algorithm. If you think in term of programming language, there is no way of coding your algorithm without using either goto or function call.
This is because several different execution paths lead to the same result (that is "Assign flight" for example).
Maybe you can paste here what you get with the old version of activity mapping and we can see if we can improve it.
Sorry about that!
commented Mar 24, 2023 by Lode

Hi again,

here is an example of what is should look like:

Flow.png

Don't mind the layout, I quickly made this in powerpoint :)

There should be only one endpoint of course instead of two, btw.

Best regards,

Lode

commented Mar 24, 2023 by plantuml (295,000 points)
edited Mar 24, 2023 by plantuml

Here is the image

https://ibb.co/C5PZLV8

0 votes
answered Mar 24, 2023 by The-Lu (65,440 points)

Hi L., and all,

From:

Here is my proposal using experimental `label` / `goto`:

And corresponding source code:

@startuml
Title Distribution of open flights cockpit
start
if (Reserves available?) then (Yes)
    :Analyse if reserve\nis suitable;
    if (Suitable reserve\navailable?) then (Yes)
        label tmp
        label tmp
        label tmp
        label tmp
        label tmp
        label tmp
        label tmp
        label tmp
        label tmp
        label tmp
        label tmp
        label A
        :Assign flight;
        stop
    else (No)
        :Search for voluntary\nswap flight;
        if (Voluntary\nswap found?) then (Yes)
            label tmp
            label tmp
            goto A
        else (No)
            :Request flight operations for CGW;
            if (Request approved?) then (Yes)
                :Send SMS;
                if (Volunteer available?) then (Yes)
                    if (Is volunteer suitable?) then (Yes)
                        label tmp
                        goto A
                    else (No)
                        if (Make volunteer suitable\nby delaying flight) then
                            :Assign delayed flight;
                            stop
                        else (No)
                             label tmp
                            label C
                            :Cancel flight;
                            stop
                        endif
                    endif
                else (No)
                    label tmp
                    label tmp
                    goto C
                endif
            else (No)
                label tmp
                label tmp
                label tmp
                label tmp
                label tmp
                label tmp
                goto C
            endif
        endif
    endif
else (no)
    :No reserves available;
    :Request flight operations for CGW;
    stop
endif
@enduml

Enjoy,
If that can help,

Regards.

commented Mar 25, 2023 by Lode
Hi all,

thanks for the suggestions. As said, the goto solution works, but looks terrible.

PlantUML is such a great tool, but the activity diagram (both the old and new one) stays below my expectations. The tweaking with labels, different color lines and arrows ending without connecting to the correct box, looks simplistic.

It makes perfect sense to make several arrows of different questions end up at the same box/action. I think this example is a good one to improve the activity diagram and improve the functionality. You should just say 'goto X' and the arrow should end up at the correct box with consistent formatting/layout.

Best regards,

Lode
...