EXECUTE.ACTION.LOOP

  • Updated

 

The EXECUTE.ACTION.LOOP command enables the repeated execution of a specified action based on the number of rows in a designated table data source. This guide outlines the process for configuring the input data source, passing input values to the executed action, and handling output values returned to the executing action.
The input data source (specified by the ‘From’ property) needs to be a table source to control the execution loop. The executed action will be performed once for each row in the data source

Properties

From Name of the input data source. If none is specified, the system will default to the one labelled 'FROM'
To Name of the output data source. When a value is specified, a data table with this name is returned containing the ‘FROM’ and ‘TO’ columns of the From source, along with an additional column showing the result / success of each loop iteration. If no value is specified, the system will default to producing a data source labelled  'TO' .
Action The Action to be executed.

Parameters

@ExecuteActionOnErrorAndProceed Define an error handling action to be executed if the called action throws an error. After the error handling action has been executed, the main action will continue executing the next steps. The error handling action is called with data sources from the action where the error occurred along with data sources from the calling action. If the same data source exists in both, the data Source from the excepted action will be used.
@ExecuteActionOnErrorAndStop Define an error handling action to be executed if the called action throws an error. Once the error handling action has been executed, the main action will terminate, and no subsequent steps will be executed.. The error handling action is called with data sources from the action where the error occurred, along with data sources from the calling action. If the same data source exists in both, the one from the excepted action will be used.
@ExecuteActionOnErrorAtEndOfLoop Define an error handling action to be executed if one or more loops throw an error. The error handling action will be executed after the loop end and the main action will continue afterwards. The error handling action is called with the data sources from the calling action.

Map

This Command does not use any value mappings.

Passing input values to the executed action

Input data from the executing action can be accessed in the executed Action in one of two ways, depending on the use case: 

  1. Using the FromTableRow Input Table Source
    The FromTableRow input table source provides access to all columns of the input table for the current iteration. Each row of the input table is fully available to the executed action during its respective iteration. 

  1. Using the FROM Input Text Source
    The executed action can access a subset of the input data through the ‘FROM’ data source. Prerequisites for this: 

    • The input table(from the executing action) must include a column named 'FROM'
    • The value in the 'FROM" column for each row is passed to the executed action as the 'FROM' data source.

Returning Output Values to the executing action

 Prerequisites for returning data from the executed action to the executing action: 

  • The input table in the executing action must include a column named 'TO'. 

  • The executed action must define a data source named ‘TO’ to return data for each iteration. 

  • In the executing action, the returned data source will be named according to the value specified in the ‘TO’ column of the corresponding row in the input table. 

Example 1 - Using multi-value input (FromTableRow)

If multiple values from the supplied input table are required, the entire table row is available in the executed action in the data source FromTableRow.

FromTableRow is a Perfion data table that matches the columns of the supplied input table in the executing action but contains only the one row (based on the current iteration).

image-20251022-114625.png

Figure 1: Prepared table to send to the executed action. Contains custom columns needed in the executed action.

The picture above shows a prepared multi-columned data table for sending into a loop.

As shown in the figure below from the executed action, the input data table FromTableRow exposes all columns from the table provided by the executing action and presents them in a single-row table. All action commands using a neutral data table as input support this format.

image-20251022-115323.png

Figure 2: In the executed action, the desired columns from the input table are mapped.
 
If you'd like to try Example1 yourself, you can download it below and test it locally.  
 

Example 2

The figure below shows a data table prepared to be passed to the executed Action. It contains the input values (in the ‘FROM’ column) that will be sent to the Action, along with the name of the data source (in the ‘TO’ column) where each iteration should return its output.

image-20251022-143112.png

Figure 3 - Prepared table to send to the executed action. Contains the FROM and TO columns

The input value from the 'FROM' column in the supplied data source of the executing action is accessible via the 'FROM' data source in the executed action. This data source can be used directly in commands.

image-20251022-143633.png

Figure 4 - Reading the input value in the executed action and writing 
the output value back to the executing action.

The example uses the ‘FROM’ value from the FilesToIterate table from the executing action and reads it using the SELECT.EXCEL command.

The result is written to a data source called ‘TO’, which is the required source name to be returned to the executing action.
In the executing action, the ‘TO’ data source from each iteration of the executed action is named according to the value defined in the ‘TO’ column of figure 3.

image-20251022-143916.png

As the FilesToIterate table contains four rows, the executed action is executed (looped) four times, each returning one data source back to the executing action.

If you'd like to try Example2 yourself, you can download it below and test it locally. 


Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.