Execute a code until a specified condition is true using the While component in RPA Desktop Design Studio.
Watch this video to learn how to use the While component.
Before you begin
Role required: none
About this task
You can configure the properties for the While component.
Table 1. Properties of the While component
Property
Description
Delay After Execution
The number of seconds to pause after running.
Delay Before Execution
The number of seconds to pause before running.
Delay for each execution (Seconds)
Specified delay before each execution of the code while the
condition is true.
Enable Timeout
Option to set a timeout value.
Timeout
Number of seconds that the operation ends after if not completed. To apply this value, you must set the Enable Timeout property.
Procedure
In the Toolbox pane, navigate to Loops > While.
Drag the While component to the Design surface.
Double-click the light-yellow colored field () under the WHILE component bar.
Enter the condition.
A Data In port is dynamically added for the parameter that contains the
While condition.
Connect the data and control ports of the While component to the corresponding
ports of the other components as described in the following table.
Port name
Purpose of connection
Port type
Data type
The name of the port is the same as the name of the parameter that defines the condition.
Takes the value of the parameter. The component matches the value with the condition.
For example, i<=10.
Data In
Object
ControlOut
Use the port at the end of the While Loop to continue to the next action flows.
Control Out
LoopPort
Use the port to perform actions inside the While Loop (such as calculating expressions, logging values, and so on).
Control Out
(Optional)
To test the component, under the DESIGN tab, click
Run.
Example: While component
Drag Variable component before the While component. Add Expression component and MessageBox components after the While component. In the Variable component, enter 1. In the Expression component, enter
i+1. Set a Breakpoint at the Expression component. In the While component, enter i<=10.
When you run this automation, the value 1 is incremented to 2 and shows in the output, MessageBox, as 2. When you select Move next on the Design tab, the value is incremented until 11. Since the condition
matches at this point, i<=10, the loop ends and automation is ended.Figure 1. While component
We use cookies on this site to improve your browsing experience, analyze individualized usage and website traffic, tailor content to your preferences, and make your interactions with our website more meaningful. To learn more about the cookies we use and how you can change your preferences, please read our Cookie Policy and visit our Cookie Preference Manager. By clicking “Accept and Proceed,” closing this banner or continuing to browse this site, you consent to the use of cookies.