If Node in Pathways

From FojiSoft Docs
Revision as of 23:09, 5 March 2025 by Mitchell.Hirsche (talk | contribs) (Mitchell.Hirsche moved page Documentation: If Node in Pathways to If Node in Pathways)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The If node in Pathways is used to create conditional logic within a workflow. This node evaluates a given condition and determines which branch of the workflow to execute based on whether the condition evaluates to true or false.


Configuration Options

  1. Name
    • Assign a name to the node that describes the condition being evaluated (e.g., "Check Data Validity").
  2. Condition Expression
    • Type: Choose the format in which the condition is written:
      • Script: Use a scripting language to write complex conditions.
      • Handlebars Template: Use Handlebars syntax for conditions based on template-driven logic.
    • Expression Field: Define the actual condition to evaluate. This could involve comparisons, checks, or dynamic expressions based on workflow variables.

Purpose and Benefits

  • Decision Making: Allows workflows to diverge into multiple paths based on logical conditions.
  • Dynamic Execution: Executes only the relevant tasks, improving efficiency and reducing unnecessary computations.
  • Customizable Logic: Supports both scripting and template-based logic, catering to different levels of complexity.

Behavior

  • True Path: Executes tasks in the branch if the condition evaluates to true.
  • False Path: Executes tasks in the branch if the condition evaluates to false.

Usage Scenarios

  1. Validation Checks:
    • Example: Verify if a form submission is complete. If true, proceed to data processing; if false, notify the user of missing fields.
  2. Data Routing:
    • Example: Direct high-priority tasks to a separate processing queue while routing low-priority tasks to a different workflow.
  3. Conditional Actions:
    • Example: Send an email if a threshold is exceeded; otherwise, log the data for later review.

Example Configuration

  • Condition Type: Script
  • Expression: user.age >= 18
    • This checks if a user's age is 18 or above.
  • True Path: Execute tasks for adults.
  • False Path: Execute tasks for minors.

The If node is a vital component for creating flexible and intelligent workflows in Pathways, enabling dynamic branching based on logical conditions.