Switch
Description

A Switch Node is used to create different Flow paths, based on an operand with multiple possible values.
The operand
can be set manually to Intent
, State
, Type
and Mode
, or custom CognigyScript
. In the appended Case Nodes, you then set the different values for the selected operand. The operand is evaluated during the execution of the Flow, and the result is compared with the values of each case. If there is a match, the Flow path of the matched case will be executed. If there is no case match, the path of the Default Node will be executed.
If you choose CognigyScript as operand, you use Direct CognigyScript like in the If Node. You can also select to parse the CognigyScript as a string or not.
Switch Nodes are used if the number of possible options becomes too large to use If Nodes. Instead of saying if
ci.intent === "orderFood"
then x, else ->ci.intent === "orderDrink"
, else ->ci.intent === "askHelp"
, else e ..., you can simply use a switch on Intent with multiple cases (orderFood
,orderDrink
,askHelp
) and a default.
Types

CognigyScript
This is the default setting for the Switch Node, with this you can access ci, cc and cp values to make a decision.

Intent
With this setting you get Intent dropdowns for the Case Nodes. This is a simplified version of the CognigyScript Type switching on ci.intent
.

State
This switches on ci.state
.

Type
This switches on ci.type
.

Mode
This switches on ci.mode
.

Updated over 3 years ago