DoWhile

This activity allows the user to execute a sequence of actions to be repeatedly
executed as long as a specified condition meets true. In other words, it
creates a loop where the associated activities are executed repeatedly until
the condition specified within the activity becomes false.

Technical Reference

 

MISC

Condition: This indicates the condition to be met while the sequence of actions is executed.

 

You can either provide the values hardcoded in “Boolean” format or enter the values in “Boolean” datatype.

 

This field accepts the values in “Boolean” datatype.

DisplayName: Displays the name of the activity. The activity name can be customized which will help in troubleshooting.

Represents mandatory fields to execute the workflow.

 

 Here’s an example of how the activity works –

In the following example, I am about to perform the counter variable condition where
the bot meets the value “10”, the execution will be completed. Here I have already
created a variable “Counter” in “Integer” datatype and assigned default value as “1”.

Steps to execute the bot:

1.       Open an existing solution or create a new solution as “ControlFlow”.

2.       The ControlFlow feature will be available in the toolbox on the installation
of the Designer.

3.       Drag and drop the “DoWhile” activity to the workflow and set it as start node.

a.       Here I am using this activity to execute the sequence of actions in loop until
the specified condition is met.

 

4.       Double click on the activity.

5.       Here, I am adding the “Assign” activity into the “Body” of “DoWhile” activity.

a.       Providing the “Counter” variable created already in the “TO” field.

b.       Now, providing the value as “Counter + 1”.

6.       Now, I am adding the “WriteLine” activity inside the body of the “DoWhile”
activity.

a.       Here I am providing the value as “Counter.ToString” in the “Text” field of the
activity to write the number.

b.       The “.ToString” is advised to use along with any other data types other than
string format. It converts any data type into string.

7.       Now, Here I am specifying the condition as “Counter =10” in the box.

8.       Save and execute the workflow.

The bot executes the workflow and when it reaches the condition, since
it gets the value of 1=10 according to the condition, which is false, it
aborts the workflow and gives, and output of the counter is 1.