Steps Repetition
Repetition allows you to generate a step several times to run in parallel or sequence.
There are two main methods to repeat steps in a process:
-
Repeat Steps for each result of an XPath query.
-
Repeat Steps for Records returned by a SQL Operation.
Repeat Steps
To enable step repetition using the result of an XPath Query:
-
Select the step in the process diagram, right-click and then select Show Properties View.
-
In the Generation section of a step or process:
-
Provide an XPath Query. The step will be generated for each value returned by this query.
-
Provide a Variable Name. This variable will contain each of the values returned by the query and pass them to the step. You can use this variable name in the step code.
-
Specify whether this repetition must be Sequential or Parallel.
-
-
-
Press Ctrl+S to save the process.
This repetition applies to the generation. It can be used for example to create a step for each table in a model. |
Repeat Steps for Records
The direct bind link is a specific type of link that allows you to run a target step once for each record returned by a SQL Operation action.
To configure step repetition with a SQL Operation:
-
Create the first step using a SELECT SQL Operation.
-
Create a second step of any type, including an INSERT/UPDATE/DELETE SQL Operation. This second step is repeated for each record returned by the select operation.
-
Link the first step to the second one using a Bind Link from the process Palette.
-
With this configuration, the columns of the records returned by the select operation can be used in the second action using the bind syntax: :{column_name}:
, where column_name
is the name or alias of the column returned by the SQL Operation.
You can also bind session variables using the bind syntax :\${variable_path}:
, where variable_path
is the name or path of the session variable.
-
Create a first step that performs a SELECT SQL Operation with the following query:
SELECT CUST_NAME, CUST_COUNTRY, CUST_CODE FROM CUSTOMER
-
Create a second step uses the Write a file built-in action, with the following value for the output file name (Txt Write Filename) parameter:
/cust/docs/customer_:\{CUST_CODE\}:_content.txt
-
Link the first and second steps using a Bind Link.
As a result, one file is written per customer returned by the select statement. The file is named after the customer code (CUST_CODE
).
Handling Failures
The execution of a bind link stops by default if one of its iterations fails. The corresponding error is then thrown and the target step is put in error.
You can change this behavior to let all the iterations run, even when an error occurs in one of them, by unchecking the Stop Bind On Error parameter in the Advanced tab of the target step.
This parameter can only be changed on steps targeted by a bind. Moreover, when multiple errors occur during the bind iterations, it is the first encountered that is thrown on the step at the end of the execution. |