Mapping Outputs In Mapplets
You can configure a mapplet to return mapping outputs. You can bind the mapping outputs from a mapplet to the mapping outputs at the mapping level.
When you include a mapplet in mapping, the mapplet computes the value of the outputs and passes the output values to the mapping. You can bind more than one output from a mapplet to the same output at the mapping level. You can also bind system-defined outputs from a mapplet to the mapping outputs. The mapplet outputs and the mapping outputs must be the same type.
For example, a mapplet might return the maximum value of a Salary port, a Bonus port, and a Commission port in three mapping outputs.
The following image shows the Out_Salary, Out_Bonus, and Out_Commission mapping outputs in the Outputs view:
The Outputs view contains the following fields:
- Name
- The name of the output. Default is Output.
- Type
- The type of the mapping output. You can select a numeric type or a date/time type. Default is Integer.
- Precision
- The length of the mapping output field.
- Scale
- The digits to the right of the decimal in the mapping output field.
- Aggregation Type
- The type of aggregation to perform on the output expression. Choose SUM, MIN, or MAX. Default is SUM.
- Binding
- The name of an output from another mapplet to bind to this mapping output. The Binding field is blank unless the mapplet contains another mapplet that is returning the mapping output.
- Description
- The description of the mapping output.
For each mapping output in the mapplet, create an associated output expression in the Expression transformation. Each expression identifies the fields to aggregate.
The following image shows the mapping output expressions in the Expression transformation:
For this example, the Expression transformation aggregates the Salary and Commission port values. The Out_Bonus mapping output is an expression that includes the Bonus port value plus 10% of the Bonus.
Bind Mapplet Outputs to Mapping Outputs
If a mapplet computes mapping outputs, you need to pass the output values from the mapplet to a mapping.
Bind the mapplet outputs to the mapping outputs on the mapping Outputs view.
The following image shows the Max_Compensation mapping output at the mapping level:
At the mapping level, you can bind the Salary mapplet output, the Bonus mapplet output, and the Commission mapplet output to the same mapping output called Max_Compensation.
To bind a mapplet output to a mapping output, click the Binding column for the mapping output. A list of available mapplet outputs appears. The list contains mapplet outputs that are the same type and aggregation as the mapping output. Select the mapplet outputs to assign to the mapping output.
The following image shows the Outputs Binding dialog box:
After you select the outputs to bind to Max_Compensation, the Binding field contains the following text:
Mplt_Compensation.Out_Salary,Mplt_Compensation.Out_Bonus,Mplt_Compensation.Out_Commission
The following image shows the mapping outputs in the Binding field:
Set the mapping output aggregation type is MAX. The Data Integration Service returns the highest compensation value that it finds from the Salary, the Bonus, or the Commission ports.