Anda di halaman 1dari 8

BANGALORE TECHNICAL TRAININGS Onlinetrainingsbglr@gmail.

com +917411642061

Lab 17
Mapplets

BANGALORE TECHNICAL TRAININGS..........................1 Onlinetrainingsbglr@gmail.com.....................................1 +917411642061.................................................................1 Lab 17...............................................................................1 Lab at a Glance................................................................2 Objectives..............................................................2 Summary................................................................2 Duration.................................................................2 Exercises..........................................................................3 Exercise 1: Import the Sources and Targets .........3 Exercise 2: Create the Mapplet .............................5

PowerCenter 9.x Level I Developer Lab Guide

17 - 1

Lab 17. Mapplets

Lab at a Glance
The exercises in this lab are designed to walk the student through the process of creating a mapplet. A mapplet is a group of transformations that are saved as a set, and can be used in any mapping.

Objectives
After completing the lab, the student will be able to: Understand the characteristics of a mapplet. Create a mapplet.

Summary
A mapplet is a reusable group of transformations, connected to perform a logical task. Mapplets are stored in the Mapplets node in the Navigator window and can be added to any mapping by dragging and dropping. Mapplets are created in the Mapplet Designer. In this lab, students will create a mapplet that will be used in a later lab. SOURCES: TARGETS: ODS_INVOICE ODS_LINE_ITEM out_PROFIT_PERCENT

The completed mapplet should look as follows:

Duration
This lab should take approximately 30 minutes.

17 - 2

PowerCenter 9.x Level I Developer Lab Guide

Lab 17. Mapplets

Exercises
Exercise 1: Import the Sources and Targets
Step 1. Import the source tables.

PowerCenter 9.x Level I Developer Lab Guide

17 - 3

Lab 17. Mapplets

Import ODS_LINE_ITEM and ODS_INVOICE as sources.


If the link is already there, skip this step.

Add the foreign key/primary key relationship from ODS_LINE_ITEM.INVOICE_NO to ODS_INVOICE.INVOICE_NO. You can do this by clicking and dragging from ODS_LINE_ITEM.INVOICE_NO to ODS_INVOICE.INVOICE_NO.

17 - 4

PowerCenter 9.x Level I Developer Lab Guide

Lab 17. Mapplets

Exercise 2: Create the Mapplet


Step 1. Create a mapplet. Select Tools | Mapplet Designer or click the Mapplet
Designer

button.

Choose Mapplets | Create and name the mapplet mplt_PROFIT_PERCENT. Add the ODS_INVOICE and ODS_LINE ITEM sources and remove their source qualifiers, if automatically created. Create a single source qualifier for the two sources:

Rename the Source Qualifier sq_ODS_INVOICE_ODS_LINE_ITEM. Step 2. Create an Aggregator. Create an Aggregator and name it agg_PROFIT_PERCENT. Copy/link ports from sq_ODS_INVOICE_ODS_LINE_ITEM to the agg_PROFIT_PERCENT as shown below:

PowerCenter 9.x Level I Developer Lab Guide

17 - 5

Lab 17. Mapplets

The ports, QUANTITY, DISCOUNT, PRICE and COST should be I (input only) ports. Create a new Port called PROFIT_out (decimal 10,2), O (output only) with the following expression: SUM(((PRICE*((100-DISCOUNT)/100))COST)*QUANTITY) Group by REP_NO, CUST_NO, DATE_OPEN and PRODUCT_CODE.

17 - 6

PowerCenter 9.x Level I Developer Lab Guide

Lab 17. Mapplets

Step 3. Create a mapplet output transformation. Select Transformation| Create, then select Mapplet
Target definitions are not allowed in a mapplet. An output transformation transports the data from a mapplet to the mappings that use it. Each output transformation created in a mapplet displays as an output group, similar to the router, when viewed in a mapping.
Output.

Name the Output transformation out_PROFIT_PERCENT. Copy/link all of the output ports from agg_PROFIT_PERCENT to out_PROFIT_PERCENT:

Rename the PROFIT_out port to PROFIT. Save the mapplet. Review the mapplet node in the Navigator window. Locate the newly created mplt_PROFIT_PERCENT mapplet:

PowerCenter 9.x Level I Developer Lab Guide

17 - 7

Lab 17. Mapplets

17 - 8

PowerCenter 9.x Level I Developer Lab Guide

Anda mungkin juga menyukai