IF/ELSE
A conditional branching node, often referred to as an IF/ELSE node, allows you to split a workflow into two or more paths based on specific conditions.
1. Basic Structure:
IF Condition: This is the primary condition you define. You select a variable (e.g., user input or a calculated value), set a condition, and specify the value that the condition should meet.
Example: If the ticket message contains the word “refund”, then the condition is considered True.
ELSE Condition: If the IF condition is not met (evaluates to False), the workflow will follow this alternative path.
2. Extended Structure with ELIF (Else If):
ELIF Condition: This is an additional condition you can add after the initial IF condition. It works similarly to the IF condition but provides more flexibility by allowing multiple conditions to be evaluated sequentially.
Example: If the ticket message contains the word “urgent”, the ELIF condition can define a separate path.
Multiple ELIFs: You can chain several ELIF conditions to check various scenarios before finally defaulting to an ELSE path.
Example: If the ticket message contains the word “refund”, follow one path; if the ticket message contains the word “urgent”, follow another; otherwise, use the ELSE path.
3. Execution Flow:
IF Path: If the initial IF condition evaluates to True, the workflow will execute the actions defined in this path.
ELIF Path: If the IF condition is False, but an ELIF condition is True, the workflow follows the ELIF path.
ELSE Path: If neither the IF nor any ELIF conditions are met (all evaluate to False), the workflow defaults to the ELSE path.
4. Condition Types
Contains
Not contains
Starts with
Ends with
Is
Is not
Is empty
Is not empty
Taking the above Sentiment Analysis as an example:
IF Condition: Select the title variable from the start node, with the condition is not empty .
IF condition evaluates to
True
, follow the IF path by querying title-related knowledge through the google search.
Last updated