Executes a user-defined Script and passes the result to an optional execution path, looping while the specified condition is met.
To use this node, start by connecting the input data to the initialInput input pin, which provides the initial input into the Do While Conditional loop.
Write the while condition and select the row to check against this condition.
Connect the outputToLoop and inputFromLoop pins to a chain of nodes to execute during each loop iteration. These pins may be connected directly to each other if all of the data manipulation occurs in the Script.
Finally, connect the finalOutput pin to the rest of the data flow.
Each row of the data connected to the initialInput pin is read. If there is data on the inputFromLoop it is used instead.
The WhileCondition and the WhileConditionRow are evaluated and if the condition is matched, the data is passed to the outputToLoop pin, otherwise the data is passed to the finalOutput pin
The chain of nodes connected to the outputToLoop pin is executed, and the process begins again.
Properties
WhileConditionRow
Optionally specify which row of data on the inputFromLoop pin to validate against the while condition. Choose from:
- Any - the node will continue looping while any row meets the while condition.
- All - the node will continue looping while all rows meet the while condition.
- 1 - the node will continue looping while the first row meets the while condition.
- 2 - the node will continue looping while the second row meets the while condition.
Alternatively you can specify the specific row to validate against. The default value is Any.
WhileCondition
Specify a Script expression that must be met for the node to continue looping.
Example: Continue looping while count is less than 10.
'count' < 10
A value is required for this property.
AccumulateLoopOutput
Optionally specify whether to include the output from each pass through the loop in the final output.
The default value is False.
For example, assume the following:1. The loop increments the input field 'count' by one each pass through the loop.2. The loop will terminate once 'count' equals five.3. The input pin has a single row like so:
|count|
| 1 |
If AccumulateLoopOutput is false, the final value in the 'count' column is 5 and there is only one row:
|count|
| 5 |
If AccumulateLoopOutput is true, a row is added for each pass through the loop:
|count|
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
Example data flows
A number of sample Data Flows are available from the Samples workspace, found in the Analyze Directory page.
In the Directory under the /Data360 Samples/Node Examples/
folder, you will find "Looping with Do While nodes", which shows examples of how to use this node.
Inputs and outputs
Inputs: initialInput, inputFromLoop.
Outputs: finalOutput, outputToLoop.