Activity Diagram - How to merge different else conditions

0 votes
asked Apr 5, 2022 in Question / help by Bini

Hi

New user to PlantUML. I have a few IF/ELSE scattered about where the main chunk I have defaulted the 'happy path' with no action but it merges to a final action below. The else part of all of these I have had to duplicate an action + stop. I am sure there must be a way to merge them as well but not able to figure it out. 

Below is the text, the entries in red are the ones I feel I shouldn't have to duplicate and also I am not sure I want to 'stop' either as I have not done the analysis but feel if they can be merged to another action will continue to another path with further actions.

thanks

Bini


|Venue|
start
:Request Price;

|#AntiqueWhite|Neutrino|

:Check If\nIn Scope;

if (Client Entity\nin Scope ?) then (no)
	(yes) elseif (Prod=NDF,\nFWD,STRIP ?) then (no)
 	(yes) elseif (Any Legs\n> 1Y ?) then (no)
	else (yes)

		:Check Request\nAgainst XVA Data;
		if (Client\nFound ?) then (yes)
			If (Pair\nFound ?) then (yes)
				If (XVA Data\nComplete ?) then (yes)
				else (no)
					#red:Block Pricing;
					stop
				endif
			else (no)
				If (Default\nPair Found ?) then (yes)
					If (XVA Data\nComplete ?) then (yes)
					else (no)
						#red:Block Pricing;
						stop
					endif
				else (no)
					#red:Block Pricing;
					stop
				endif
			endif
			:Calc XVA;
			stop
		else (no)
			
			if (Default\nClient\nFound ?) then (yes)
				if (Pair\nfound ?)
					if (XVA Data\nComplete ?) then (yes)
					else (no)
						#red:Block Pricing;
						stop
					endif
				else (no)
					if (Default\nPair\nFound ?)
						if (XVA Data\nComplete ?) then (yes)
						else (no)
							#red:Block Pricing;
							stop
						endif	
					else (no)
					endif
				endif
			else (no)
			endif
			:Calc XVA;
			stop
		endif

endif

:Price without XVA;

stop

1 Answer

0 votes
answered Apr 5, 2022 by The-Lu (89,080 points)

Hello B.,

See similar request here, and on the forum:

But, without `swimlane`, you can use experimental `goto`, (with some overlapping...) as:

If that can help,
Regards.

commented Apr 5, 2022 by anonymous
Thank you for the prompt reply. So "goto" is one option, the lines will start to look messy i guess but makes sense.

If I were to draw it manually I would somehow merge them to one.

Much appreciated
commented Apr 6, 2022 by anonymous
Goto does not work whether direct in online server or via the confluence macro for plantuml.

I have revised below to be complete but am struggling on 2 points.

1) I want to join "Store XVA for reporting" to connect to "Send Price To Client"

2) Under "Pricing" group I want to avoid duplicating "Apply MU to TraderPrice" if I can merge into 1

3) Under "Pricing" group I have an extra condition on the right that could never be met as 1st 3 conditions will not allow, so how do I remove?

Any help on this will be appreciated.

thanks

@startuml

|Venue|

start

:Request Price;

|#AntiqueWhite|Neutrino|

:Receive Price Request;

:Check If\nIn Scope;

if (Client Entity\nin Scope ?) then (no)

(yes) elseif (Prod=NDF,\nFWD,STRIP ?) then (no)

  (yes) elseif (Any Legs\n> 1Y ?) then (no)

else (yes)

group CheckXVAData

:Check Request\nAgainst XVA Data;

if (Client/Pair\nData Complete ?) then (yes)

else (no)

if (Client/DefaultPair\nData Complete ?) then (yes)

else (no)

if (DefaultClient/Pair\nData Complete ?) then (yes)

else (no)

if (DefaultClient/DefaultPair\nData Complete ?) then (yes)

else (no)

#red:Stop Pricing;

stop

endif

endif

endif

endif

end group

group Pricing

:Calc XVA Value;

:Calc MU Value;

if (XVA < 0 ?) then (yes)

label applymu

:Apply MU\nto TraderPrice;

(no) elseif (XVA >= MU ?) then (yes)

:Apply XVA\nto TraderPrice;

' goto applymu

(no) elseif (XVA < MU ?) then (yes)

:Apply MU\nto TraderPrice;

endif

end group

:Price using\nXVA or MU;

:Store XVA\nFor Reporting;

stop

endif

:Price without XVA;

:Send Price to Client;

|Venue|

:Receive Price;

stop

@enduml
...