What is a Loop Container?
A loop container refers to an automated execution node that can perform cyclic execution. It can repeatedly execute predefined actions (known as the "loop body") multiple times.
When to Use a Loop Container?
Scenario 1: In an ERP system, when calculating multi-level BOM material requirements, multiple data entries obtained from pre-queries need to be processed step by step to analyze material requirements layer by layer until all levels of material calculations are completed.
What is a BOM?
A BOM (Bill of Materials) is typically multi-level, involving parent-child hierarchical relationships.
Scenario 2: In the inventory management and lead distribution scenario, when performing scheduled inspection tasks, upon changes in the quantity of items added to the inspection queue, the loop container is used to initiate inspection tasks for all data.
Prerequisite
This is a paid feature. For details, contact our Sales Team.
How to Set a Loop Container?
Step 1 Creating an automation pro and configuring the trigger node
Select the form you want to create an automation pro, and go to Edit > Extension > Automations.
After creating the automation pro, configure the trigger node based on your needs.
Step 2 Adding a Loop Container
Add a loop container after the existing node.
Note: Currently, only one loop container can be added to a single automation pro.
Step 3 Selecting Loop Mode
Within the loop container, two looping methods are supported, each suitable for different scenarios.
Mode 1: Specify a node and execute a loop for each piece of data within the node
Mode 1: Specify a node and execute a loop for each piece of data within the node
How to Set this Mode?
First, ensure that there is a node before the loop container that outputs multiple pieces of data, such as the "Add Record" node or the "Query Records" node. Then, select the node you want to loop through within the loop container.
When will the Loop End?
All the data added or queried in the preceding step must enter the loop. After processing all the data, the loop will automatically end.
When to Use this Mode?
In material calculations, the loop container is used to calculate the detailed quantities of lower-level materials based on the product BOM.
Query multiple lower-level materials based on the product BOM.
Input each queried data entry into the loop.
Calculate the required quantity for one lower-level material.
Update the required quantity for the corresponding material in the material table.
Mode 2: Do not specify which data to loop through; set "End Loop" within the loop
Mode 2: Do not specify which data to loop through; set "End Loop" within the loop
How to Set this Mode?
When choosing the option to not specify which data to loop through and setting the "End Loop" method within the loop, a maximum loop count must be configured:
Note: The maximum number of loop iterations must not exceed 200.
When will the Loop End?
Automatically ends after completing the specified number of loops.
Automatically ends when encountering the "End Loop" node during execution.
When to Use this Mode?
In equipment inspection, when the number of items to be inspected is >= 0, a series of loop operations is performed. The loop ends when the condition is no longer satisfied.
What's the Difference between the Two Modes?
Mode 1: Query multiple data entries first, then enter the loop for single data processing. Before executing the loop container node, all data added or queried must go through the loop for processing. Each data entry is calculated individually.
Mode 2: Enter the loop first, then query multiple data entries for batch processing. When the amount of data to be processed is large or dynamically changing, branch nodes and end loop nodes can be set within the loop body to determine whether to end the loop.
Step 3 Determining What to do when the loop fails
When a failure occurs during the loop, you can handle it using one of the following options:
Skip the failed iteration and proceed to the next loop:
Ignore the failed data and move on to process the next one, keeping the loop running until all data is handled.End the loop and execute the nodes following the loop:
Stop the loop immediately and proceed to the next step in the workflow.Stop the execution of the Automation Pro:
Terminate the execution of the Automation Pro completely.
Step 4 Configuring the loop body
After the loop container is configured, you can set up the loop body. Within the loop body, click and select the nodes you want to add.
If you choose the "Do not specify which data to loop through" method, you must add an End Loop node at the end.
More to Know
A maximum of 10 nodes can be added within the loop body, and loop containers cannot be added.
Currently, configuring loop containers in Automations Pro triggered by buttons is not supported.
When setting action nodes within the loop body, you can call "current loop data" and data from preceding nodes of the loop container. However, in action nodes after the loop container, the "current loop data" cannot be called.