2

I am trying to do nested if statements in plantuml. Here's the code:

@startuml
start
:Search for File;
if(Is in local cache?) then (yes)
    :Finish;
    stop
else (no)
    :Check Cached SearchObjectToNodeTb;
        if(Find in SearchObjectToNodeTb) then (yes)
            :Send refresh req. SO to SN;
        else(No)
            :Send SO query to closest SymbolToNodeCacheTb match;
            if(Symbol in Table) then (yes)
                switch(What role am I?)
                    case(SearchNode)
                        :Send out Query to SN and get SearchObject;
                    case(FileNode)
                        :Return results;
            else(No)//can't find the if statement for here
                switch(What role am I?)
                    case(client)
                        :Send to Node with closest result;
                    case(SearchNode)
                        :Perform alg. for tablesym. creation;


@enduml

It can't see the last if statement for the else. Is it possible to do nested if else statements in plantuml?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
SomethingsGottaGive
  • 1,646
  • 6
  • 26
  • 49

1 Answers1

3

As far as I can see the endswitch (see e.g. https://plantuml.com/activity-diagram-beta) is missing the following works for me:

@startuml
start
:Search for File;
if(Is in local cache?) then (yes)
    :Finish;
    stop
else (no)
    :Check Cached SearchObjectToNodeTb;
        if(Find in SearchObjectToNodeTb) then (yes)
            :Send refresh req. SO to SN;
        else(No)
            :Send SO query to closest SymbolToNodeCacheTb match;
            if(Symbol in Table) then (yes)
                switch(What role am I?)
                    case(SearchNode)
                        :Send out Query to SN and get SearchObject;
                    case(FileNode)
                        :Return results;
                endswitch
            else(No)
                switch(What role am I?)
                    case(client)
                        :Send to Node with closest result;
                    case(SearchNode)
                        :Perform alg. for tablesym. creation;
                endswitch
@enduml
albert
  • 8,285
  • 3
  • 19
  • 32