Do While - Data360_Analyze - 3 - 3.12

Data360 Analyze Server Help

Product type
Product family
Data360 Analyze
Product name
Data360 Analyze
Data360 Analyze Server Help
First publish date

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 loop.

Write the Script to execute during each loop iteration in the WhileScript property. See below for an example Script.

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.

Example Script: loops until the count field is greater than or equal to 20 on all rows

# Set condition to true on the first pass
if (firstExec) then condition = true

#Increment count by 1
emit 'count' + 1 as count
# check if the condition is matched
condition = condition and (20 > 'count')
# After all records are processed, check if the condition is still true.
if (lastInGroup and condition) then {	# If the condition is still true, set returnCode 101 to	
	# reschedule the node and continue iteration.



Specify the Script to be processed each pass through the loop.

In order for the loop to continue, the function setSuccessReturnCode must be called with a status code of 101, otherwise the data flow is free to begin processing the next node.

A value is required for this property.


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:

|  1  |

If AccumulateLoopOutput is false, the final value in the 'count' column is 5 and there is only one row:

|  5  | 

If AccumulateLoopOutput is true, a row is added for each pass through the loop:

|  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.

Note: Upgrades will overwrite all data flows in the workspace. If you want to make changes to one of the sample data flows, we recommend you create a copy and save it elsewhere, using Save as...

Inputs and outputs

Inputs: initialInput, inputFromLoop.

Outputs: finalOutput, outputToLoop.