Skip to content

Loop End

The Loop End component is used to finish a loop in your workflow. It takes the data that was produced inside the loop and gives you two pieces of information: the original item that the loop started with, and the final processed data. This lets you use the original data later in the workflow or keep a record of what was processed.

How it Works

When you create a loop in Nappai, you usually start with a Loop Start component that feeds items into the loop body. Inside the loop you can perform any number of actions on each item. The Loop End component collects the output from the loop body and automatically attaches the original item that was being processed. It does this locally within the workflow engine, so no external services are involved. The component simply passes along the data it receives and adds the original item as an extra output.

Inputs

Input Fields

  • Data: The processed data from the loop’s body.
    This is the value that comes out of the last component inside the loop and is forwarded to the next part of your workflow.

Outputs

  • Item: Type Any (method: get_current_item).
    This output gives you the original item that the loop started with for the current iteration. You can use it to reference fields from the original data or to combine it with the processed result.

Usage Example

Suppose you have a list of customer orders and you want to add a discount to each order.

  1. Loop Start feeds each order into the loop.
  2. Inside the loop you run a Discount Calculator component that adds a discount field.
  3. The Loop End receives the discounted order as Data and outputs the original order as Item.
  4. You can then connect the Item output to a Merge component to combine the original order details with the new discount information, or you can send the discounted order to a database.
  • Loop Start – Begins a loop and provides the initial items.
  • Loop Body – The set of actions that are repeated for each item.
  • Merge – Combines two data streams, useful for attaching the original item to the processed result.
  • Data Store – Saves the final output of the loop to a database or file.

Tips and Best Practices

  • Always connect the Loop End to the next component in your workflow; otherwise the loop will finish without passing data forward.
  • Use the Item output when you need to reference fields from the original data after processing.
  • If you only need the processed data, you can ignore the Item output and use the Data input of the next component directly.
  • Keep the loop body simple; complex logic can be moved to separate components before the Loop End.

Security Considerations

The Loop End component processes data locally and does not interact with external services, so there are no additional security risks beyond those of the components inside the loop. Ensure that any sensitive data handled within the loop is encrypted or masked as needed before it reaches the Loop End.