Taskflows > Taskflows > Parameters in taskflows
  

Parameters in taskflows

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:
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 or mapping 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:
    1. 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.
    2. 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:
    3. 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.
    4. 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.
    5. 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.
    6. 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.
    7. 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.
    8. 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.
    9. 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:

Guidelines for using in-out parameters

Use the following guidelines when you use in-out parameters in a taskflow:

Example: Overriding parameters with a Data Task step

You want to override the following input parameters in a mapping task, MyMT :
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:
    1. aClick the Add icon, and then navigate to and select MySourceConnection.
    2. bClick Edit. The Edit Value dialog box opens.
    3. cIn the field next to Source, select the Content.
    4. 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:
    1. aClick the Add icon, and then navigate to and select MySourceObject.
    2. bClick Edit. The Edit Value dialog box opens.
    3. cIn the field next to Source, select Content.
    4. 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:
    1. aClick the Add icon, and then navigate to and select MyTargetConnection.
    2. bClick Edit. The Edit Value dialog box opens.
    3. cIn the field next to Source, select Content.
    4. 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:
    1. aClick the Add icon, and then navigate to and select MyTargetObject.
    2. bClick Edit. The Edit Value dialog box opens.
    3. cIn the field next to Source, select Content.
    4. dIn the field next to Value, enter output10.txt.
    The following image shows the Input Fields of Data Task 1:
    The image shows the Input Fields section of Data Task 1. There are four parameters. The target object parameter has been overridden from its default value of output5.txt to output10.txt.
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.