Loop End
Loop End is a simple component that you drop at the end of a loop in your workflow.
It collects the data that was produced inside the loop and gives you two useful pieces of information: the current item that the loop is working on and the final data that resulted from the loop’s processing.
How it Works
When you run a loop, each iteration processes one item and produces some output data.
The Loop End component waits until the loop finishes, then:
- Retrieves the original item that was being processed in the last iteration.
- Passes along the processed data that was generated by the loop body.
Both pieces of information are made available to the next component in your workflow, so you can decide what to do with the final results or the specific item that caused an issue.
Inputs
Input Fields
- Data: The processed data from the loop’s body.
Connect the output of the component that generates the data inside the loop to this input.
Outputs
- Item: The original data item that the loop was processing when it ended. This is useful if you need to reference the specific input that produced the final output.
Usage Example
Suppose you have a loop that takes a list of customer orders, enriches each order with shipping information, and then calculates the total cost.
At the end of the loop, you drop a Loop End component to collect the final enriched order data and the specific order that triggered the loop.
-
Loop Body
- Input: Order ID
- Output: Enriched order data
-
Loop End
- Input: Enriched order data
- Output:
- Item: The last order processed (useful for debugging or logging)
- Data: The fully processed order ready for the next step (e.g., storing in a database)
You can then feed the Item or Data output into a “Save Order” component or any other downstream process.
Tips and Best Practices
- Keep the loop body as efficient as possible; the Loop End component only waits for the loop to finish.
- Use the Item output to log or debug specific iterations that may have failed or produced unexpected results.
- If you only need the final processed data, you can ignore the Item output to keep the workflow tidy.
Security Considerations
- Loop End operates entirely on data that flows within the Nappai system.
- No external APIs or services are called, so the component does not introduce new attack vectors.
- Ensure that any sensitive data handled by the loop is properly masked or encrypted before it reaches this component if it needs to be stored or logged.