Loops

Doing the same thing multiple times might look like a bad idea, but we usually are doing slightly different things in each iteration, and with loops, we can factor out the repetition, and our workflows are easily reused.

A few notes about the loops:

  • The flow variables that they generate are read-only; when you replace them, you do not modify them (as those are handled internally), just hide them from further processing
  • The loops can be nested, so it is possible to have things done quite a lot of times

The simple Counting Loop Start node just feeds the same input table (as many times as specified) to the loop, each time increasing the currentIteration flow variable.

When you would like to iterate without the [0, maxIteration-1] interval or the preferred increment is not one, you should consider using the Interval Loop Start node instead of the counting.

Iterating through a table and splitting the input table to smaller chunks can be useful when it is too large to handle it with the workflow; however, it can also be used to make sure that certain parts are analyzed independently. With the Chunk Loop Start node, the data will be split to parts with n rows, or they will be split to n parts depending on the configuration. When you want to group the rows, not by their order, but by their values in certain columns and use those chunks for processing, you should use the Group Loop Start node.

With the Column List Loop Start node, you can go through the selected columns of the input table without extracting them in the table. An alternative is using the TableRow To Variable Loop Start node and the Extract Table Spec node. Both looping nodes keep not just the current iteration number in a workflow variable, but other information too (the column name in the former case or the row's actual values in the latter).

The Generic Loop Start node can be thought of as a do … while loop's do part. It is just a delimiter of the loop. The while part is the Variable Condition Loop End node.

When you use the Loop End node to signal the end of a loop, the generated tables (the input of this node) will be concatenated, and if that is not possible (for example, incompatible columns are generated), it will fail. When you want to have your generated columns available, you should end the loop with the Loop End (Column Append) node (the tables are joined by their row IDs, so be sure they are compatible in this case).

In cases where you need to return multiple tables from the loop, the previous loop end options are not satisfactory; however; the Loop End (2 Ports) node enables you to collect the tables from two sources and return them separately.

The Variable Loop End is useful when you do not have any tables to collect, because it does not accept tables as input. It returns the variables for each iteration, so it can be useful when you are debugging a looping flow.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.27.171