Iterative loop refers to the automatic repetition of a process. Iterative loops are mainly used in situations where repetitive tasks need to be automatically executed. Compared to manually executing repetitive tasks, iterative loops can greatly save time and effort required to execute tasks. Iterative loops are divided into two modes, namely paired loops and nested loops. The default mode is pairing loop.
- Pairing loop: refers to the one-to-one matching of each data in the set data in sequence. It should be noted that when the number of elements is m and n respectively, the number of executions is the minimum of m. When m>n, the loop will only execute n times.
- Nested loop: that is, cross loop matching is performed on each data in the set data.
Instructions
Connect the set dataset to a single valued input.
Right click on the tool node - Iteration Mode - Paired Loop/Nested Loop.
It should be noted that iterative cycles are only meaningful when used in multiple loops.
Iterative loops are meaningful only when used in the case of single value input, otherwise the correct iteration result cannot be obtained.

Scenario 1: Batch Processing of Iterative Datasets
When the number of datasets in the data source is very large, iterative datasets can be used for batch processing of the data. When iterating through the dataset, the iteration mode can be selected according to the actual situation to achieve iterative batch processing.
In the following model, buffer analysis needs to be performed on the iterative dataset. When two iterative datasets are connected to the buffer analysis tool node, that is, Option selects the iterative mode. Then, when the model runs, pairing/nested loops can be performed on the two iterative datasets.

Scenario 2: Batch processing of set variables
Variables support the creation of set data, and multiple data can be set in batches. At the same time, set variables support selecting data across data sources, and batch processing can be achieved by using iterative loops. For example, performing buffer analysis on three data points in a certain region, the specific steps are as follows:
Create a set type variable: Click on the "Processing Automation" tab, select the "Variables" group, and the drop-down menu will display a list of all data types that can be used in the model. Double click on a variable of vector dataset type, check the set option, and you can add three vector datasets through the "Add" button in the property panel. Next, create an integer variable and add a buffer distance, setting three distances: 50, 100, and 150. Build the following model on the canvas:

Select the 【 Buffer 】 tool node and select Pairing/Nesting Loop from the right-click menu. The difference between the two loop modes is as follows:
Pairing cycle. As shown in the figure below, according to the data correspondence, Dataset A corresponds to a distance of 50; Dataset B corresponds to a distance of 100; Dataset C corresponds to a distance of 150 for buffer analysis, resulting in three results.

Nested loop. As shown in the following figure, Dataset A is analyzed three times according to 50, 100, and 150, while Dataset B and Dataset C are also analyzed at three distances, resulting in nine results.

Scenario 3: Batch Processing of Datasets
Batch processing of source data sometimes only requires outputting a Result Dataset. For example, batch deleting UserIDs and POPs from the World dataset_ 1994 fields, and then erase the Worldpart dataset from the World data.
According to the principle of nested loops, since two values are filled in the field_set, Erase will execute twice to generate two Result Dataset results_ Erase and result_ erase_ 1. These two datasets are the same, so by default, intelligent deduplication is performed on the calculation results to obtain a Result Datasetresult_ Erase avoids resource waste.
