Want to show Test Query in diamond AND share target activity

0 votes
asked Nov 19 in Question / help by systemsincode (180 points)
edited Nov 19 by systemsincode

I want to have the a series of choices and on each choice 'diamond' I want to show the query. However I also want to be able to link to the same activity shape from different result choice diamonds.In the old activity diagram I can't get the query to show on the diamond, but I can share target activity shapes from different choice diamonds. In new activity beta the opposite is true: I can show the question on the diamond choice but I can't get different choices to share targets!

NEW:

@startuml
header Minimum Reproducible Example
title Can't point two queries to same activity
start
!$shared = SHARED
!$nonShared = NON-SHARED

:Minimum Reproducible Example;
if (Test Question) then (yes)
:$shared;
else (no)
    if (Second Test Question) then (yes)
        :$shared;
    else
    :$nonShared;
stop
@enduml

OLD: 

@startuml
header Minimum Reproducible Example
title "Can't put test query text in condition diamond"

!$shared = "SHARED"
!$nonShared = "NON-SHARED"

(*) -down-> "Minimum Reproducible Example:"
if "TEST QUESTION" then
-DOWN-> [yes] $shared
else
-RIGHT-> [no] if "SECOND TEST QUESTION" then
-DOWN-> [yes] $shared
else
-RIGHT-> [no] if "THIRD TEST QUERY" then
-DOWN-> [yes] $nonShared
-> (*)
@enduml

https://gist.github.com/systemsincode/591f86597efff9fd9cf279ab486ece0b

1 Answer

+1 vote
answered Nov 19 by The-Lu (36,540 points)
selected Nov 19 by systemsincode
 
Best answer

Hello S.,

Here is a proposal, adapted from:

With `label` and `goto`, as:

@startuml
header Minimum Reproducible Example
title Proposal to point two queries to same activity
start
!$shared = SHARED
!$nonShared = NON-SHARED

:Minimum Reproducible Example;
if (Test Question) then (yes)
  label sp_lab0
  label lab
  ':$shared;
else (no)
    if (Second Test Question) then (yes)
        label sp_lab
        goto lab
    else
    :$nonShared;
    stop
    endif
endif
:$shared;
@enduml

If that can help,
Regards,
Th.

commented Nov 19 by systemsincode (180 points)
edited Nov 20 by systemsincode
Brill I had a go with just goto label before but I think I had the labels the other way round...many thanks
commented Nov 20 by systemsincode (180 points)
@The-Lu I can't find much documentation on the Label keyword is it documented somewhere?

Also don't know if you want to answer this question via SO https://stackoverflow.com/questions/70041006/plantuml-activity-choice-if-else-show-question-on-diamond-and-share-targets-acro
commented Nov 21 by soichisumi
edited Nov 22
Hi, I tried the goto statement in my environment, but it does not seem to connect to the label in some cases.

Spacing by label may solve the problem, but why is spacing by label necessary in some cases?

Any information would be appreciated.
commented Nov 22 by The-Lu (36,540 points)

Hello all,

is it documented somewhere?

This functionality (is under development, and not on final release...[See last remarks here]) and is also not fully documented.
I just add the example on the doc.

To see another doc., ref, see:

And for information, the first example seems to no longer work...

You can also make a search here:

but why is spacing by label necessary in some cases?
Any information would be appreciated.

Then, for spacing label, it is just by try and start again...wink
@plantuml: have you some element about that?

If that can help,
Regards,
Th.

...