Using loops
You can run a set of actions repeatedly within your workflow. When added to the canvas, it acts as a block where you can include multiple actions to create a mini-workflow. You can then connect this loop action to other actions of your workflow.
When you run the workflow, webMethods Integration runs this mini-workflow repeatedly until the specified count is reached. You can also nest loops for more complex workflows.
- Loop breadcrumbs - At the upper-left side, you can see the loop breadcrumbs. Whenever you create a loop within a loop, the breadcrumb for that loop is appended here. You can use this breadcrumb to go to any particular loop level.
- Loop start - This marker indicates the beginning of the loop.
- Loop end - This marker indicates the end of the loop.
- Connectors - From the right window, you can add and configure connectors between the loop start and loop stop.
- Close loop canvas - Click this icon to return to the main workflow canvas.
- Loop settings - Click the settings icon to configure the loop action.
To configure the loop settings, hover on the Loop action and click the Settings icon that appear. The Loop page appears. On the right side, you can see the Action configure window where you can provide inputs to run the Loop action.
There are two types of loops.
- Times - The Times loop runs a specific action a set number of times.
- Each Item - The Each Item loop does one or more actions on each element of a collection.
The following list identifies the loop output keys along with their descriptions.
-
currentIndex - Returns the index of the array/object element currently under execution.
-
currentItem - Returns the value available inside the element currently under execution.
-
currentKey - Returns the name of the key, which is provided as the source array/object.
-
currentValue - Returns the value available inside the element currently under execution. This value is mostly similar to the value of the currentItem key.
-
totalLength - Returns the total length of the source array/object.