pyflowchart icon indicating copy to clipboard operation
pyflowchart copied to clipboard

How can a ConditionNode deal with 3 conditions

Open vesslan-dal opened this issue 3 years ago • 2 comments

vesslan-dal avatar Jan 14 '22 05:01 vesslan-dal

Here's my demo:

1,StartNode connect OperationNode("step1") 2,OperationNode("step1") connect ConditionNode 3.1,ConditionNode connect_yes OperationNode("step2") 3.2,ConditionNode connect_no OperationNode("step1") 3.3 ConditionNode (how to)connect EndNode

vesslan-dal avatar Jan 14 '22 05:01 vesslan-dal

I am sorry but a multi-branch condition node is not yet supported by the depended flowchart.js. See https://github.com/adrai/flowchart.js/issues/60 and https://github.com/adrai/flowchart.js/issues/101 . So pyflowchart will be unable to deal with your case now.

As a quick fix, you can use two (or more) nested condition nodes :

if exp1 { 
   // branch 1
} else {
    if exp2 { 
        // branch2
    }
    else { 
        // branch3
   }
}

cdfmlr avatar Jan 14 '22 07:01 cdfmlr