Loop - Do While
Task in alpha phase
This Data Factory task is in phase. You can contact the Product-Live team at contact@product-live.com if you want more details and get an early access.
This task allows to perform a loop over a list of elements inside a Data Factory job. The loop is a DO_WHILE
loop that executes a set of tasks until a condition is met.
Examples
json
{
"name": "loop",
"taskReferenceName": "loop",
"description": "",
"optional": false,
"type": "DO_WHILE",
"inputParameters": {
"elements": [
1,
2,
3
]
},
"loopCondition": "if ($.loop['iteration'] >= $.elements.length) { false; } else { true; }",
"loopOver": [
{
"name": "json-transform-jq",
"taskReferenceName": "get_current_element",
"type": "SUB_WORKFLOW",
"inputParameters": {
"data": {
"elements": "${loop.input.elements}",
"iteration": "${loop.output.iteration}"
},
"queryExpression": ".data.elements[.data.iteration - 1]"
}
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Definition
WARNING
This task does not support the Data Factory variable as an input parameter.
Property | Type | Required | Description |
---|---|---|---|
The name (or type) of the task | |||
The unique name of the task in your job. It is used to reference this task in the workflow. | |||
The functional description of this task in your job. | |||
The type of the task. It must be DO_WHILE . | |||
Input parameters of the loop. | |||
The condition to evaluate if the loop should continue. The condiction is a valid javascipt expression evaluate by the [JavaScript engine Nashorn](https://en.wikipedia.org/wiki/Nashorn_(JavaScript_engine). | |||
The list of tasks to execute inside the loop. |
Outputs
Property | Type | Description |
---|---|---|
The current iteration of the loop | ||
Map containing the results of each iteration of the loop (see example below) |
Example of an output generated by the loop task:
json
{
"1": {
"get_current_element": {
"result": 1,
"error": null,
"resultList": [
1
]
}
},
"2": {
"get_current_element": {
"result": 2,
"error": null,
"resultList": [
2
]
}
},
"3": {
"get_current_element": {
"result": 3,
"error": null,
"resultList": [
3
]
}
},
"iteration": 3
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30