You can use a taskflow to pass input parameters and in-out parameters to a task.
You can design a mapping with input parameters or in-out parameters. When you add a mapping task to a taskflow, you can override the parameter values. The mapping task passes these parameters to the mapping. You can use the parameterized mapping task in different scenarios.
If a PowerCenter task uses input parameters or in-out parameters, you can override the parameters in a taskflow.
The following section explains input and in-out parameters and how you can use them in a taskflow:
Input parameters
An input parameter is a placeholder for a value or values in a mapping or PowerCenter task. You define the value of the parameter when you configure the mapping task or PowerCenter task. For more information about input parameters, see Mappings and Tasks.
If a PowerCenter task uses input parameters, you can override the input parameters in a taskflow.
You can use a taskflow to override the following subset of mapping input parameters:
- String. Changes the string value to be used as input for the mapping task.
- Source object. Changes the object that the mapping task reads from.
- Source connection. Changes the connection that the mapping task uses to read from the source.
- Target connection. Changes the connection that the mapping task uses to write to the target.
- Target object. Changes the object that the mapping task writes to.
- Source_dataFormat. Changes the data format for a precision value or any other value for a particular column in the formatting file.
- Source_defaultPrecision. Changes the precision value for all the columns in the formatting file.
For example, consider a fully parameterized mapping task. The mapping task uses an SQL connection to read from the employeeaddress table and a JDBC connection to write to the employeedetails table.
You can create a taskflow and override parameters in the mapping task. For example, you can use a Salesforce connection to read from the employeeincome table and a flat file connection to write to the file income.txt.
In-Out parameters
An in-out parameter is a placeholder for a value that can you can pass in to or out of a mapping or PowerCenter task. Unlike input parameters, an in-out parameter can change each time a task runs. You can use a taskflow to override any type of in-out parameters that a mapping task or PowerCenter task supports. For more information about in-out parameters, see Mappings and Tasks.
For example, consider a mapping that keep tracks of how many rows it processes using an in-out parameter named lastprocessedindex. Every time you run the mapping, it resumes processing from this index. And also, let us say that every time the mapping is executed, it processes 5000 rows.
You can configure the taskflow such that the mapping task runs till it reaches records number, say, 50000.
Note: If the in-out parameters in the selected mapping task are added or updated, you must reselect the mapping task in the taskflow to use the updated mapping task.
Overriding parameters in a taskflow
Override the parameters of a task when you use it in a taskflow. You can override parameters with the Data Task step or with the Assignment step.
Overriding parameters or parameter files in a Data Task step
If the Data Task step uses a PowerCenter task ormapping task with a flat file source, you can override the parameter values that are set in the task. If the Data Task step uses a mapping task, you can override the native data type, default precision, and default scale. If the Data Task step uses a mapping task available on the Secure Agent machine, you can override the parameter file directory or parameter file name set in the mapping task. If the Data Task step uses a mapping task available in a cloud-hosted repository, you can override the parameter file connection and parameter file object set in the mapping task.
Perform the following steps to use a Data Task step to override a Data Integration parameter or parameter file:
1Create a taskflow and add a Data Task step.
2Add a task that contains parameters or uses a parameter file to the Data Task step.
3Go to Data Task > Input Fields.
4Click Add.
5Perform one of the following steps:
aTo override the parameter file directory or parameter file name of a mapping task that is available on the Secure Agent machine, expand the Task Properties Parameters list. Then, select Parameter File Directory or Parameter File Name.
Note: If the object that you want to override is under a directory, use double forward slashes (//) or %2F from the third-level onwards in the file path. For example, to override input1.csv, which is located under infa.bucket/flat_file_dir/parameters/input1.csv, use one of the following formats:
bTo override an input parameter or in-out parameter of a mapping task or PowerCenter task, expand the Input Parameters or InOut Parameters list. Then, navigate to and select the parameter that you want to override.
cTo override the parameter file connection and parameter file object of a mapping task that is available in a cloud-hosted repository, expand the Task Properties Parameters list. Then, select Parameter File Connection and Parameter File Object.
Note: When you configure the Data Task step to override the parameter file connection and parameter file object, you must ensure that both the parameters, that is, source object and source connection are passed either through the parameter file or taskflow. Otherwise, an error occurs.
dTo override the native data type, default precision, or default scale of the source data of a mapping task, expand the Input Parameters > Sources > Source list. Then, select Source_defaultNativeDataType, Source_defaultPrecision, or Source_defaultScale respectively.
Note: The values set in the Source list take precedence over the values set in the mapping task and the data format field in the Data Task step. If the values in the Source list are incompatible with the values set in the mapping task and the data format field in the Data Task step, the job might fail. The default precision and scale values are applied to all the columns in the formatting file.
eTo override the values in the Update Columns field that is defined in the target of the mapping task, expand the Input Parameters > Targets > Target list. Then, select updateColumns. You can enter multiple column names separated by commas enclosed within or without double quotes.
Note: You can override the Update Columns field only if the mapping task uses an update or upsert operation.
6Click Edit.
The Edit Value dialog box appears.
7Under Source, select Content. For advanced use cases, you might select Field or Formula.
8Under Value, enter the new value that you want to override the default value with.
Note: For data format, Formula is selected by default, and the payload appears within a single quote in the Value field. You can click f(x) and override the values in the Expression Editor. Alternatively, you can select Field if the field contains the payload. However, the field that you choose must contain the payload using Formula within a single quote in the Assignment step.
9Click OK.
Overriding parameters with an Assignment step
Perform the following steps to use an Assignment step to override a Data Integration parameter:
1Create a taskflow and add a Data Task step.
2Add a mapping task that contains input parameters to the Data Task step.
3Drag an Assignment step onto the canvas.
4Go to Assignment Properties > Assignments.
5Click the Add icon, and then navigate to and select the parameter you want to override.
6Under Value, select Content. For advanced use cases, you might select Field or Formula.
7Enter or select the object or connection that you want to use to override the default object or connection.
Guidelines and best practices for using parameters in a taskflow
The following sections describe guidelines and best practices when overriding parameters in a taskflow.
Guidelines for using input parameters in taskflows
Use the following guidelines when you use input parameters in a taskflow:
•Use the Data Task step to override input parameters. However, in advanced cases, you can override input parameters with an Assignment step.
•If you define a field to override the same parameter in both the Assignment step and the Data Task step, the taskflow considers the value assigned in the Data Task step.
•If you use a Data Task step to assign values to input or in-out parameters, the assignments must be independent of each other. If you use an Assignment step to assign values to input or in-out parameters, an assignment operation can use the result of a previous assignment operation in the same step.
For example, you have two source objects, SO1 and SO2. You want to override SO1 with the value Account and override SO2 with the value SO1. Use the Assignment step to override the parameters.
The following image shows the source object SO2 overridden with the value of SO1:
•When you run a taskflow as an API, you can use the connection parameter to pass a connection name or connection ID at run time.
For example, if you want to use the connection name, you must pass the connection name in the connection parameter as shown in the following sample:
•When you configure the Data Task step to override the parameter file connection and parameter file object, you must ensure that both the parameters, that is, source object and source connection are passed either through the parameter file or taskflow. Otherwise, an error occurs.
Guidelines for using in-out parameters
Use the following guidelines when you use in-out parameters in a taskflow:
•If you define a field to override the same parameter in both the Assignment step and the Data Task step, the taskflow considers the value assigned in the Data Task step.
•Use the Data Task step to override in-out parameters unless your use case specifically demands the usage of the Assignment step.
•You can get the current value of the in-out parameter only after the taskflow executes the Data Task step. You cannot get this value before the taskflow runs the Data Task step.
Example: Overriding parameters with a Data Task step
You want to override the following input parameters in a mapping task, MyMT :
•The source data object parameter, MySourceObject, with default value input.txt.
•The source connection parameter, MySourceConnection, with default value My File Connection.
•The target connection parameter, MyTargetConnection, with default value My File Connection.
•The target data object parameter, MyTargetObject, with default value output5.txt.
MyMT uses My File Connection to read from the input.txt file and My File Connection to write to the output5.txt file.
You want MyMT to use My File Connection read from the input.txt file and use table and then use My File Connection to write to another output file, output10.txt file.
To do this, perform the following steps to override the default value of MyTargetObject with a Data Task step:
1Create a taskflow and add a Data Task step, Data Task 1.
2Go to Data Task 1 > Data Task and add the mapping task MyMT.
3Go to Data Task 1 > Input Fields.
4Perform the following steps to add MySourceConnection to the Input Fields section of Data Task 1:
aClick the Add icon, and then navigate to and select MySourceConnection.
bClick Edit. The Edit Value dialog box opens.
cIn the field next to Source, select the Content.
dIn the field next to Value, select My File Connection.
5Perform the following steps to add MySourceObject to the Input Fields section of Data Task 1:
aClick the Add icon, and then navigate to and select MySourceObject.
bClick Edit. The Edit Value dialog box opens.
cIn the field next to Source, select Content.
dIn the field next to Value, enter input.txt.
6Perform the following steps to add MyTargetConnection to the Input Fields section of Data Task 1:
aClick the Add icon, and then navigate to and select MyTargetConnection.
bClick Edit. The Edit Value dialog box opens.
cIn the field next to Source, select Content.
dIn the field next to Value, select My File Connection.
7Perform the following steps to add MyTargetObject to the Input Fields section of Data Task 1:
aClick the Add icon, and then navigate to and select MyTargetObject.
bClick Edit. The Edit Value dialog box opens.
cIn the field next to Source, select Content.
dIn the field next to Value, enter output10.txt.
The following image shows the Input Fields of Data Task 1:
You have overridden the target data object parameter, MyTargetObject from the default value output5.txt to output10.txt.
Note: You only need to add parameters that you want to override to the Input Fields section. In this example, you only override MyTargetObject. However, you have the option of overriding MySourceObject, MySourceObject, and MyTargetConnection as well.