For Loop Node in Pathways

From FojiSoft Docs

The For Loop node in Pathways is used to execute a sequence of tasks for a specified number of iterations. It enables the dynamic repetition of processes within a defined range. Below are the configurable options for the For Loop node:


Configuration Options

  1. Name
    • Specify a unique name for the For Loop node to identify it in your workflow.
  2. Variable Name
    • Define the name of the loop variable that will hold the current iteration value during each loop cycle.
  3. From
    • Set the starting value of the loop.
    • The value can be configured using either Handlebars Template or Script expressions, selectable in the dropdown.
  4. To
    • Define the ending value of the loop.
    • Similar to the From field, the value can be configured using Handlebars Template or Script expressions.
  5. Inclusivity
    • Choose whether the ending value (To) is inclusive or exclusive:
      • < To (exclusive): Iterations will stop before the specified ending value.
      • <= To (inclusive): Iterations will include the specified ending value.

Usage Scenarios

  • Performing a repetitive task, such as data transformation or calling an external service multiple times.
  • Iterating over a range of numbers to generate incremental values or calculations.
  • Defining a custom workflow that requires controlled repetition with dynamic start and end values.

Validation Notes

  • Ensure the loop variable is unique within the workflow to avoid conflicts.
  • Carefully configure the From and To fields with valid expressions to prevent infinite loops or errors.
  • The inclusivity option determines the exact number of iterations and should align with your workflow's requirements.

Example Configuration

  • Variable Name: i
  • From: 1 (using Script)
  • To: 10 (using Handlebars Template)
  • Inclusivity: < To

In this setup, the loop will iterate from 1 to 9, executing the defined tasks for each value of i.


This configuration ensures flexibility while maintaining ease of use, allowing users to build complex workflows efficiently.