Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

Activity beta --- Any way to put a text on arrow going to 'elseif' node?

0 votes
Hi,

With the new activity syntax, the arrow representing the 'false' branch of an 'if'-construct can always get a text by putting an 'else (text-on-arrow)', even if that branch is left empty.

However, if an 'elseif' follows an 'if', that is not possible. Is there any way to put a text on the arrow going from the 'if'-node to the 'elseif'-node?

Thx
asked Aug 4, 2016 in Wanted features by ivokrab (170 points)

1 Answer

0 votes

Which version of PlantUML are you using ?

The following example is working on the online server:

@startuml
start
if (foo) then (ok3)
elseif (foo2) then (ok2)
else (notok)
endif
@enduml

But maybe we did catch the real bug. Please provide a simple non-working example if this is the case.

Thanks!

 

answered Aug 4, 2016 by plantuml (112,180 points)
I am using the online server. Have not gotten around to installing PlantUML locally.

My question was: in your example, how do I get a text on the arrow going from 'foo' to 'foo2' (which represents the 'else'-path to the first condition)? It is not so much a bug as a shortcoming in the grammar, maybe. I could of course just nest another 'if' in the 'else'-clause of the first one, but then I lose the specific layout with parallel paths that the 'elseif's generate...

Actually, in the current situation, the structure represents more a 'case'-statement, with multiple options being checked for the same variable, rather than a real 'if'-'elseif', where the second decision can use a completely different criterion.
With last beta:

https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

You can now have:

@startuml
start
if (foo) then (ok3)
:f1;
(additional text) elseif (foo2) then (ok2)
:f2;
else (notok)
:f3;
endif
@enduml

Is this what you are expecting ?
Thanks a lot, this is what I was looking for.

I just suggest to position the label to the start of the arrow. I mean, in this example, the "additional text" label would be better if positioned like the "notok" label.

Congratulations for the work!
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...