While

The While component is a control flow component that enables a user execute a code repeatedly, based on a given boolean condition.

Screenshot

Ports

The While component exposes Control In, Control Out, Dynamic data In ports are created once the defined condition is entered.

Port Description
Control In Must be connected to the Control Out port of one or more components.
Control Out Must be connected to the Control In port of any other component. The While component exposes the following two types of Control Out ports.
1. Success: Execution control is passed to this port when the while loop ends.
2. Port to iterate in loop:Control is passed to this port while the Boolean condition is true.
Dynamic Data In The While Loop component creates Dynamic Data In ports based on the condition configured.

Properties

To edit the properties of the While component, in the Properties window, change the required property. You can edit the following properties:

Property Description
Search Search for the respective property.
Delay After Execution Specifies the wait time (in seconds) after the action is executed.
Delay Before Execution Specifies the wait time (in seconds) before the action is executed.
Delay for each execution (Seconds) Specifies the wait time (in seconds) for each step of the execution until the While loop ends.

Example

Let us consider an example of verifying whether a number is less than Ten.

Screenshot

To use the While component:

  1. In the Toolbox, expand Loops.
  2. Drag the While component and drop it on the Design surface.
  3. In the component edit text box, enter a condition. In this example, we will enter the condition i<10.
  4. Add a Variable component to define "i" in the While component.
  5. To add a Variable component:

    • In the Toolbox, expand General.
    • Drag the Variable component and drop it on the Design surface.
    • User want to change the name Double-Click the Variable_1 box.
    • Specifies the name to identify the component. Set the name to match the application field you are interacting with.For this example we name it as Increment.
  6. Add a MessageBox Show component to display output of the While component.

  7. To add the MessageBox Show component:
    • In the Toolbox, expand General.
    • Drag the MessageBox component and drop it on the design surface.
  8. Connect:

    • The control ports of all components.
    • The Data out port of the Variable component to the Data in port of the While component.
  9. If the condition entered in the While component is not satisfied, you can add other components which will help you satisfy the condition. In this example, we have entered the condition i<10, so for it to satisfy, we can to add the Expression component.

  10. To add the Expression component:

    • In the Toolbox, expand General.
    • Drag the Expression component and drop it on the Design surface.
    • Double-click the components edit text box and enter the input for the condition. For this example, we will enter the condition i+1.
  11. Reuse the Increment Variable component to store the Expression Increment Result Value.

  12. Connect

    • The Control out port of the Increment Variable component to the Data in port of the While component.
    • The Data out port of the Increment Variable component to the Data in port of the While component.
    • The Control out port for Looping of the While component to the Control In port of the Expressions component.
    • The Data out port of the Increment Variable component to the Data in port of the Expression component.
    • The Control out port of the Expression component to the Data in port of the ReuseIncrement Variable component
    • The Data out port of the Expression component Result Value connect to Data in port of the ReuseIncrement Variable component.
    • The Control out port of the While component to the Control In port of the MessageBox Show component and write input text to display Condition satisfied .
  13. In the toolbar, click Run.
    The output for the condition is displayed.

    Screenshot