Using the For each row in table iterator in the Loop action - Use the For each row in table iterator in the Loop action in Automation 360 to iterate through every row in a data table variable and process each record one by one.

Automation 360

Use the For each row in table iterator in the Loop action in Automation 360 to iterate through every row in a data table variable and process each record one by one.

For each iteration, the iterator assigns the current row's values to a record variable, which you can then use to read individual column values in subsequent bot actions.

This iterator is designed for in-memory data tables. It works with table variables already loaded into your bot, not directly with files or databases. It is ideal when you need to:

  • Iterate over records extracted from a web table using the Browser package.
  • Loop through rows of data retrieved from Excel using the Get multiple cells action.
  • Validate, transform, or route each record from a large dataset row by row within the same bot.
Note:
  • This iterator reads the table variable as it existed when the loop started. If a bot action inside the loop modifies the table (such as adding or deleting rows), those changes do not affect the iteration count or the remaining rows to be processed.
  • Each row is assigned to the record variable one at a time. The record variable is overwritten on every iteration.
  • If you need to preserve the value of a row for use after the loop ends, assign the row's column values to separate String or Number variables inside the loop body before the next iteration begins.
  • Values in the record variable are accessed as string types by default, regardless of the original data type in the table. Convert values using the String package or assignment actions before performing numeric operations.
  • The record variable schema must match the column names in the table variable if you plan to access values by column name. If the column names do not match, access values by index instead.
  • This iterator is only compatible with table variables. It does not work directly with CSV files, Excel files, or database sessions. Use the appropriate iterator for those sources (see Related iterators).

Prerequisite

Before using the For each row in table iterator, ensure that:

  • A table variable is already populated with data.
  • A record variable exists or is ready to be created to hold each row during iteration.

If the table variable is empty, the loop body does not execute and the bot proceeds to the next action after the Loop container.

Settings

  • Double-click or drag the Loop action from the Loop package in the Actions palette.
  • In the Label field, enter an alphanumeric label to identify this loop. Labels are useful when your bot contains nested loops and you need to target a specific loop with a Continue or Break action.
  • Under Loop type, select the Iterator option, then from the Iterator drop down, select For each row in table.
  • From the Table variable drop down, select the variable that holds the data you want to iterate over.

    If no table variable exists, click the Create variable icon to create one.

  • From the Assign the current row to this variable list, select an existing record variable or click the Create variable icon to create a new one.

    The record variable holds the values of the current row during each iteration. You can then reference individual columns inside the loop body.

  • Click Save. When the bot runs, the iterator reads each row of the table variable in sequence and executes the actions in the loop body for each row.

Access column values inside the loop

Once the current row is assigned to the record variable, use one of the following syntax inside the loop body to read individual column values:

By column index (zero-based):

$rYourVariableName[0]$    → first column
$rYourVariableName[1]$    → second column
$rYourVariableName[2]$    → third column

By column name:

$rYourVariableName{ColumnName}$

For example, if the first column is titled EmployeeID, use $rYourVariableName{EmployeeID}$ to retrieve its value in each row.

Column name access is case-sensitive. Ensure the column name you specify exactly matches the column header in the table variable.

Example

In this example, a bot loops through a table variable that contains task records and displays each row's details.

Prerequisites:

  • A table variable TaskList is already populated with the following data:
    TaskID TaskName AssignedTo
    T01 Review report Alice
    T02 Send invoice Bob
    T03 Update records Sara
  • A record variable CurrentRow has been created.

Step 1 — Configure the Loop action

  1. Drag the Loop action into the bot.
  2. Under Loop type, select Iterator, then select For each row in table.
  3. In Table variable, select TaskList.
  4. In Assign the current row to this variable, select CurrentRow.
  5. Click Save.

Step 2 — Add actions inside the loop body

Add a Message Box action inside the loop to display:

Task: $CurrentRow{TaskID}$ — $CurrentRow{TaskName}$ — Assigned to: $CurrentRow{AssignedTo}$

Result when the bot runs:

  • Iteration 1: Task: T01 — Review report — Assigned to: Alice
  • Iteration 2: Task: T02 — Send invoice — Assigned to: Bob
  • Iteration 3: Task: T03 — Update records — Assigned to: Sara
  • Loop exits after the last row.