Skip to main content

Loop through data table rows

Sophie avatar
Written by Sophie
Updated this week

Definition and Usage

Loop through each row in a data table and store the current row in a variable. This command allows you to iterate through data table rows sequentially, processing each row individually during the loop.


Parameter Values

Input parameters

Parameter

Description

Possible Values

Required

Options / Notes

Data table

Select an existing data table or create a new one

Any valid data table variable

Yes

You can select an existing data table or create a new one

Start row

Specify the starting row number for the loop

Integer value (e.g., 1)

Yes

Default is 1; can use variables

End row

Specify the ending row number for the loop

Integer value (e.g., -1)

Yes

Use -1 to loop through all rows; can use variables

Variables produced

This action produces the following variable:

  • Store current row into: A variable that will contain the current row data during each iteration of the loop. The default name is "currentRow" but can be customized.


Using Variables in Conditions

You can use variables in the parameter fields where you see the {x} icon. This allows you to:

  • Dynamically set the start row based on a previously calculated value

  • Dynamically set the end row based on a condition or calculation

  • Reference the current row variable in subsequent actions within the loop

When using variables, ensure they contain appropriate values (integers for row numbers, valid data table for the data table parameter).


Notes

  • The loop will process each row sequentially from the specified start row to the end row.

  • Using -1 as the end row value will loop through all rows in the data table.

  • The current row variable will be updated with each iteration, containing the data from the current row being processed.

  • Make sure the data table exists and contains data before attempting to loop through it.

  • Actions placed inside this loop will be executed once for each row in the specified range.

  • To exit the loop prematurely, you can use a "Break loop" action based on a condition.

Did this answer your question?