How to I break from a branch and join to a common outer object in my Activity Diagram?

+1 vote
asked Nov 30, 2020 in Question / help by chrisjacks (120 points)
edited Nov 30, 2020 by chrisjacks

I have the following PlantUML code.

@startuml
skinparam defaultTextAlignment center
skinparam ConditionEndStyle hline
rectangle "= OUTAGE NOTIFICATION ACTION PLAN"
start 
    :====
    !! INCOMING OUTAGE NOTIFICATION !!
    (Slack workflow triggered)
    ====;
    :All available Team A immediately\nanswer "availability" Slack workflow;
    if (Responses received within 15 minutes?) then (YES)
        if (//Entire Team A// already attending Live Outages?) then (NO)
            :Team A picks up;
        else  (YES) 
            goto lab1
        endif
    else (NO)
        label lab1
        :Team B picks up;
    endif
    :Available team members swarms on Outage/Incident;
    :Team members step away as parallelisation no longer useful;
stop
@enduml

This generates...

[IMAGE UNABLE TO BE PASTED 8000 char limit...]

I want an arrow from "if (//Entire Team A// already attending Live Outages?) then (NO)" to "Team B picks up".

In short, I would like the highlighted "YES" arrow in the branch to break that branch and join onto the outer flow "Team B picks up" object.

Is there a way to do this?

NB: one obvious "cheat" would be to put an "OR" in my wording of the first decision, for example, "Responses received within 15 minutes?  -OR-  Entire Team A already attending Live Outages?"... however this feels like a cop-out and won't always work in other situations.

The labelling approach I've used I think might be a nasty-looking green line if I got it right too, so if there's a better way than that that would be good. :)

Thanks!!

Regards,

Chris.

2 Answers

0 votes
answered Dec 22, 2020 by mgrand (140 points)
I don't seen any way to do it with the new syntax.  I have come up with a work-around, which is to use connectors to get from one branch of the diagram to another.
commented Dec 22, 2020 by The-Lu (63,920 points)

Hello all,

Use connectors:


[See code on PlantUML server]

or just repeat label as:


[See code on PlantUML server]

Without helping too much...
Regards,
Th.

commented Dec 22, 2020 by mgrand (140 points)
I normally put a detach after the departure connector, so that it is clear that the flow goes to the like labeled destination connector.
commented Dec 22, 2020 by The-Lu (63,920 points)

Hello all,

With or without detach, we can use connector as:


[See on PlantUML server...]

Regards,
Th.

commented Dec 22, 2020 by Martin
edited Dec 24, 2020

Here's a 'nasty-looking green line' version, LOL.  It's about time @Plantuml at least gave a skinparam that makes the goto arrow look normal!

Or, the other way around:

It's restricting that 'goto' can only link to already defined labels (i.e. only backwards).  But perhaps a workaround could be a 'comefrom' that works similar to a goto except:

  •  the arrow (although currently the green line doesn't have an arrow-head) would be reversed
  • it would not terminate the current flow like goto does, to allow a T junction

To make 'comefrom' work well 'detach' would have to be improved so that it can be used immediately after a label (currently you get the error "kill cannot be used here").

Here's an example, but using 'goto' instead of 'comefrom', and so the three problems above exist, namely:

  • the detach can't immediately follow a label, so I've added the dummy red node
  • the goto detaches when we don't want it to.
  • if the goto line had an arrow it would be in the wrong direction

Just a whacky idea I thought I would share, because I can see that the idea well has run dry for implementing goto!

Also I found myself adding a lot of spacing labels to line things up, perhaps a keyword 'spacer' is needed for that job.  (Similar to ||| in sequence diagrams).

commented Dec 29, 2020 by Martin
edited Dec 29, 2020

It occurred to me that my label/comefrom syntax could be replaced by goto/label.  A goto with an unrecognised label would simply process as a label (stored in a separate list from normal labels), and when that label definition is eventually encountered then it is treated as a comefrom (as described previously).  The comefrom construct then just becomes a way of thinking about a backwards goto, and isn't physically needed.

One complication is that people might then expect to be able to use a single label with a forward goto before it and a backward goto after it - so the label (as well as turning into a comefrom) should be processed as a normal label going forward.

A further complication is that multiple gotos to a single predefined label is supported.  Reversing that is tricky, because you have to allow the advance label to represent multiple locations, and then comefrom each of them when the label is finally encountered.  But in my mind it's codable.

0 votes
answered Dec 29, 2020 by Martin

I notice that the green 'goto' lines have turned to normal colouring over Xmas!  Magic!

(They are still a little whacky with their dots, thinness, and lack of arrows - but don't jar nearly so much.)

...