Flow: Evaluate

The evaluate node uses JavaScript to perform logic and return the values which are tested against predefined 'choices'. Each choice is a unique value, that when encountered directs the flow to the linked node. One or more choices may be defined to allow for flexible flows.

120

EXPRESSION


The node specific configuration is accessed by double-clicking on the node.

JavaScript can be added to the Expression field to perform core logic on session variables and choices that correspond to the output of the JavaScript configured accordingly.

622

The following table details the node specific Expression configuration tab.

FieldDescription
ExpressionUser definable JavaScript logic that processes user input, variables, or other logic and return numeric values that can be defined and acted upon later in the node.

Expressions can be built using session variables (defined in Configuration: Session Data and Custom Logs).
ChoiceA numeric value that corresponds to the output of the JavaScript code in the Expression field.

Once a choice has been defined, it will appear as an option when the Evaluate node's Exit Event is connected to another node.

This allows branching out to different nodes depending on the outcome of the JavaScript code.
TagA text remark to describe the choice. This remark will appear alongside the Choice value when connecting to other nodes.
Target NameWhen a node is connected, its name will appear as the target.
ActionAdds or deletes a choice row.
NameThe name of the node is represented as a string. Enter a new name for the node or continue with the displayed name.

Expression

The following example JavaScript code uses the variable 'response' to evaluate the resultant choices. In this case, if the value of response is 'Y' or 'YES' then the choice is set to 1, if the response is 'N' or 'NO' then the choice is set 2, and for all other values, it is set to 3.

//Response Validation 
var strRes = sysResponseMessage.toUpperCase();

if (strRes == "Y" || strRes == "YES") {
    1;
} else if (strRes == "N" || strRes == "NO") {
    2;
} else {
    3;
}

Choice

Choices are defined to correspond to the output of the Expression.
The below screen shows two choices defined, 1 for Yes and 2 for No. The Evaluate node will distinguish between the choices and when linked to other nodes, each choice can be connected to different parts of the flow. Should a choice not be defined, then the flow will pass along the oninvalidchoice event.

Tag

Tags provide a description for the choice.

618

Connecting the Exit Event of the Choice

When choices are defined, an attempt to connect the Evaluate node will result in a pop-up that requests which choice is to be associated with the target node.

322

As choices are connected, the pop-up will only display remaining choices in subsequent pop-ups.

322

SESSION DATA


For information on session data, click here .

CUSTOM LOGS


For information on custom logs, click here.

NODE EVENTS


Exit EventDescription
choiceThis event is visible and triggered when at least one choice is defined within the node's configuration.
oninvalidchoiceThis event is triggered if an invalid choice is made (an undefined choice).
onerrorThis event is triggered if an error occurs.