EXECUTE.ACTION.LOOP

Executes an Action multiple times, by looping through the input data source.

Properties

From

Name of the Input Data Source. Default = 'FROM'

To

Name of the Output Data Source. Default = 'TO'
If specified, this will return a copy of the input source, including an additional column showing the result / success of each loop iteration.

Action

The Action to be executed.

Parameters

@ExecuteActionOnErrorAndProceed

Define an Error Handling Action to be executed if the called Acton throwing an error. After the Error Handling Action is executed, the main Action will proceed execution the next steps. The Error Handling Action is called with Data Sources from the excepted Action and the calling Action. If the same Data Source exists in both, the Data Source from the excepted Action will be used. (Introduced from Perfion2022 R1)

@ExecuteActionOnErrorAndStop

Define an error handling Action to be executed if the called Acton throwing an error. After the error handling action is executed, the main Action will end execution the next steps. The Error Handling Action is called with Data Sources from the excepted Action and the calling Action. If the same Data Source exists in both, the Data Source from the excepted Action will be used. (Introduced from Perfion2022 R1)

@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 mail Action will continue afterwards. The Error Handling Action is called with the Data Sources from the calling Action. (Introduced from Perfion2022 R1)

Map

This Command does not use any value mappings.

Guide

This allows you to execute another Action multiple times.
The interface to the Action being executed is identical to the EXECUTE.ACTION command, so it does not need to know whether it is being called in a loop or not.
The input data source (specified by the From Property) therefore needs to supply a Table source to control the execution loop. The loop will be performed as many times as there are rows in the data source. Each row may specify the FROM and TO properties (as if the EXECUTE.ACTION command had been defined multiple times).

Example 1

Below shows an example of the input source, in order to pass File-paths to the Action being called, and to which data sources the result from the Sub-Action needs to be returned.

It is entirely optional whether any FROM or TO values are defined in the input data source. The columns do not even have to exist. If the Sub-Action does not need any data or return anything, it will simply be executed as many times as there are rows in the input data source.

Example 2

Below shows an example of how you can loop through a directory containing multiple Excel files, each containing product data, that needs to be imported into Perfion. The parent action will use GET.FILELIST to find all files in the directory and then pass the file path of each of those to the child action, which will then import all products in each file.

Figure 7.1 Contents of Excel1.xlsx, Excel2.xlsx and Excel3.xlsx

Below you can see first the parent action, and then the child action. Note that in the parent action the column name of the input data source must be FROM for the child action to be able to access the data.

Action Map - From

To

Command

Action

C:\Perfion Data\Import\Excel Files

ExcelFiles

GET.FILELIST

 

ExcelFiles

tbl_Files

SELECT

 

FilePath

From

 

 

tbl_Files

tbl_Files

EXECUTE.ACTION.LOOP

ChildAction

The data passed to the child action will look like this:

The child action should leave its first FROM column blank. This will allow the child action to access the data passed from the called action. Note that only a single field – the FROM column of the passed data source – is passed to the child action.

Action Map - From

To

Command

Action

 

tbl_Products

SELECT.EXCEL

 

tbl_Products

Product

IMPORT

 

Â