Skip to main content

Automation looping

Automation looping

Looping is a common method that allows the developer to iterate through a section to validate, perform, or complete an action against a collection of items. Pega Robot Studio™ provides two components for looping: ForLoop and ListLoop. You can find them in the Advanced section of the Toolbox.

looping toolbox

ForLoop

The ForLoop component enables iterative execution of logic within an automation. It contains the same elements as the ForLoop structure in programming language that allows you to execute a logic a specific number of times or until a condition is true. If the break event node triggers, or when you reach the iteration limit, the iteration ceases.

The design block contains the main methods and events for the ForLoop. The ForLoop component allows for either dynamically setting or hard-coding the Initial, Increment, and Limit parameters for the loop. Optionally, you can set the component's properties from the Properties grid.

ForLoop 1

In the following example, data from a column in an HTML table populates a list box on a Windows form.

forLoop Example 2

ListLoop

The ListLoop component allows you to read individual items of a list and execute events for each item. The component not only loops through a count of items (like the Connectable Loop) but also reads the contents of the list and outputs each item.

ListLoop 1

In the following example, the automation reads a list of items. When the value of an item matches Pega, the ListLoop execution halts through the Break method.

forLoop Example 3
If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice