studiox
2021.10
false
UiPath logo, featuring letters U and I in white
OUT OF SUPPORT

StudioX User Guide

Last updated Nov 18, 2024

Tutorial: Iterating Through Rows in a Table

In this tutorial, we will create an automation to repeat the following workflow for every row in an Excel table that does not already have a value for the Transaction #:

  1. Copy the value from the cell in the Cash In column.
  2. Paste the value to a field in a desktop application.
  3. Copy the transaction number from the desktop application.
  4. Paste the value to the cell in the Transaction # column.
  5. Click a button in the desktop application to submit the data.

We will create a project and start by adding a Use Excel File activity to indicate the Excel file to use. Inside this activity, we will add a For Each Excel Row activity to indicate that the activities should be repeated for each row as we iterate through them. Because we only want the automation to execute for the rows in our Excel file that do not contain a Transaction # value, we will add an If activity inside the For Each Excel Row activity to indicate that the activities to automate should only be executed for the rows that meet the condition that the Transaction # cell is empty.

  1. Step 1: Set up the project and get the necessary files.
    1. Create a new blank project using the default settings .
    2. Download and extract the archive with the automation project in this tutorial using the button at the bottom of this page. Copy the file DoubleUI.xlsx to your project folder, and double-click the file DoubleUI.exe to open the DoubleUI application.
  2. Step 2: Add the Excel file to the project.
    1. Click Add activity docs image in the Designer panel, and then find the Use Excel File activity in the search box at the top of the screen and select it. A Use Excel File activity is added to the Designer panel.
    2. In the activity:
      • Click Browse docs image next to the Excel file field, and then browse to and select the file DoubleUI.xlsx
      • In the field Reference as, enter UID.

        You have indicated that you will work on the file DoubleUI.xlsx that is known in your automation as UID.

  3. Step 3: Iterate through the rows in the Excel file.
    1. Click Add activity docs image inside Use Excel File, and then, in the Common Scenarios section of the search box at the top of the screen, click Repeat actions for rows in Excel range. An For Each Excel Row activity is added to the Designer panel inside the Use Excel File activity.
    2. In the For Each Excel Row activity, click Plus docs image on the right side of the In range field, and then select UID > Input [Sheet] > Transactions[Table] to select the table Transactions from the Input sheet of the file UID. Your selection is displayed in the In range field as [UID] Transactions.

      You have indicated that you want to iterate through the rows in the Transactions table.



  4. Step 4: Add the condition to be met for executing activities.
    1. Click Add activity docs image inside the For Each Excel Row activity and then, in the search box at the top of the screen, locate and click If. An If activity is added in the Use Application/Browser activity.
    2. In the If activity, click Plus docs image on the right side of the Condition field, and then select Condition Builder.
    3. In the Condition Builder, add the condition "if the Transaction # in the current row is empty":
      • Click Plus docs image on the right side of the field on the left, and then select CurrentRow > Transaction # to select the Transaction # value from the current row you are iterating through as the value to evaluate in the condition.
      • From the drop-down menu in the middle, select is empty.

        The activities you add in the Then branch of the If activity will be executed for the rows that meet this condition.



  5. Step 5: Add the desktop application and the activities to perform in it if the condition is met.
    1. Click Add activity docs image inside the Then branch of the If activity and then, in the search box at the top of the screen, locate and click Use Application/Browser. A Use Application/Browser activity is added in the Then branch of the If activity.
    2. In the Use Application/Browser activity, click Configure Window and then move the mouse pointer inside the DoubleUI window. When the window is highlighted, click anywhere in DoubleUI.

      The Use Application/Browser activity is updated and a screenshot of the application window appears inside the activity.

    3. Click Add activity docs image inside the Use Application/Browser activity and then, in the search box at the top of the screen, locate and click Type Into . A Type Into activity is added in the Use Application/Browser activity.
    4. In the Type Into activity:
      • Click Indicate target on screen, then move the mouse pointer on the Cash In field in the DoubleUI.exe application and, when it is highlighted, click the field. The text field is identified as the target and the Cash In label next to it is identified as an anchor. Click Confirm in the Selection Options window to save the selection. An image of the target and anchor is displayed in the Type Into activity.

        You have indicated that you want to type into the field Cash In from the DoubleUI.exe application.

      • Click Plus docs image on the right side of the Type this field, and then select CurrentRow > Cash In to select the Cash In value from the current row you are iterating through as the value to type.
    5. Click Add activity docs image inside the Use Application/Browser activity below the Type Into activity and then, in the search box at the top of the screen, locate and click Get Text . A Get Text activity is added in the Use Application/Browser activity after the Type Into activity.
    6. In the Get Text activity:
      • Click Indicate target on screen, then move the mouse pointer on the Transaction # value in the DoubleUI.exe application and, when it is highlighted, click the value. The Transaction # value is identified as the target and the label next to it is identified as an anchor. Click Confirm in the Selection Options window to save the selection. An image of the target and anchor is displayed in the Get Text activity.

        You have indicated that you want to copy the value for the Transaction # from the DoubleUI.exe application.

      • Click Plus docs image on the right side of the Save to field, and then select CurrentRow > Transaction # to select the Transaction # column on the current row you are iterating through as the cell where to paste the value copied from the application.
    7. Click Add activity docs image inside the Use Application/Browser activity below the Get Text activity and then, in the search box at the top of the screen, locate and select Click .

      A Click activity in the Use Application/Browser activity after the Get Text activity.

    8. In the Click activity, click Indicate target on screen, then move the mouse pointer on the Accept button in the DoubleUI.exe application and, when it is highlighted, click the button. The Accept button is identified as the target and the Cancel button is identified as an anchor. Click Confirm in the Selection Options window to save the selection. An image of the target and anchor is displayed in the Click activity.

      You have indicated that you want to click the Accept button from the DoubleUI.exe application.



    9. Click Save in the StudioX ribbon to save the automation, then click Run to execute the automation.

    The Cash In values from each row in the UID table that has no Transaction # value are entered in the DoubleUI application and the Transaction # from the DoubleUI application is copied to each row in the UID table.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.