Description
This activity makes it possible to apply a set of actions to each row in the specified table.
It has a special structure. When added to a workflow, a gray region will appear. It contains the body of the loop (i.e. the set of actions you are going to perform). Drag and drop the desired activities here and connect them with the activity block itself and the 'Loop end' block.
This is how a newly added block looks like.
A template of the 'For each row' activity
Example
Let us start with an example of a workflow that has this activity. Here we read the contents of the table, save it to a variable and output the contents by each column to the console.
An example of a workflow with this activity
The contents of the source table
These 'Console log' blocks are responsible for displaying the output. Each block displays one column of the table. Here is an example of how they are set.
This 'Console log' block outputs the contents of the 'Name' column. Others display 'Surname' and 'Age' columns and are set similarly
As a result the contents are displayed by each column
Parameters
Now let us review the parameters of the activity based on the shown example.
Table parameter defines the source table itself. imported_table is the name of the table that we have read.
It is worth mentioning that this activity is best to use in conjunction with 'Read table'. In that case, if 'For each row' is placed right after 'Read table', then you do not need to save the table content to a variable and you can leave the Save the previous step option enabled.
Table parameter
Template table defines the table (an .xls or .xlsx file) that will be used as a template to automatically generate the column variables. It is possible to either pick the same table you have already read or create a separate one. This is done to just generate the variable names for the columns.
Template table parameter
This is how the template table looks in our case.
The template table only contains the column names
Variables parameter defines what will be used for the names of the column variables: table headers as specified in the template table or plain letters.
Variables parameter
Here we can view them. Column header and column name are the same because we have chosen the Use table headers option. The variable names are editable.
Click the 'Show' button to see the details
If the Use column letters option is selected, then the Name, Surname and Age headers will be replaced with A, B and C respectively.
Results
Here is the output we have received. Each 'Console log' block displays one column (name, surname and age variables).
The table contents displayed in the console log