You are on page 1of 12

BANGALORE TECHNICAL TRAININGS Onlinetrainingsbglr@gmail.

com +917411642061

Lab
SCD TYPE3

PowerCenter 9.x Level I Developer Lab Guide

11 - 1

Lab. SCD TYPE3

Lab at a Glance
The exercises in this lab are designed to walk the student through the process of using a Lookup transformation and an Update Strategy transformation to do an SCD type1 implementation.

Objectives
After completing the lab, the student will be able to: Create and configure a Lookup and Update Strategy transformation to perform an incremental table update.

Summary
The purpose of this lab is to pull information from the SCD_INPUT flat file. The DIM_SUPPLIER3 table will be updated to keep only the partial historical data. The completed mapping should look as follows:

Duration
This lab should take approximately 40 minutes.

11 - 2

PowerCenter 9.x Level I Developer Lab Guide

Lab. SCD TYPE3

Exercises
Exercise 1: Import Sources and Targets
Step 1. Import flat file. Continue to work in the assigned student folder In the Designer, open the Source Analyzer by clicking the Source Analyzer
Analyzer.

button or by selecting Tools | Source

Select Sources | Import From File. Import the SCD_INPUT flat file from source folder. The source definition look as follows:

PowerCenter 9.x Level I Developer Lab Guide

11 - 3

Lab. SCD TYPE3

Step 2. Import the target table. Clear the Warehouse Designer workspace by rightclicking anywhere in the work area and selecting Clear All. Import the DIM_SUPPLIER3 relational target from the TDBUxx database schema.

11 - 4

PowerCenter 9.x Level I Developer Lab Guide

Lab. SCD TYPE3

Exercise 2: Create the Mapping


Step 1. Create a mapping. Create a mapping and name it m_SCD_TYPE3. Add the SCD_INPUT source definition. Add the DIM_SUPPLIER3 target definition. Save the repository. Step 3. Create a Lookup transformation (connected). Add a Lookup transformation to the mapping.

The Select Lookup Table for Lookup Transformation dialog box appears. Click the Target button and select the DIM_SUPPLIER3 table to be the lookup table.

Click OK. Copy/link SUPPLIER_CODE from SQ_SCD_INPUT to the Lookup transformation. Rename the Lookup transformation lkp_DIM_SUPPLIER3. Rename the port SUPPLIER_CODE, which came from sq_SCD_INPUT, to SUPPLIER_CODE_in. Add the following lookup condition: SIPPLIER_CODE = SIPPLIER_CODE_in Click the OK button and save the repository.

PowerCenter 9.x Level I Developer Lab Guide

11 - 5

Lab. SCD TYPE3

Step 3. Create an Expression transformation. Create a new Expression transformation. Select all ports within the SQ_SCD_INPUT source qualifier, then drag-and-drop them onto the Expression transformation.And suffix _SRC to copied ports. And pull the supplier_cd, and curr_suppler_state to the expression. And rename SUPPLIER_CD to SUPPLIER_CD_LKP, and CURR_SUPPLIER_STATE to CURR_SUPPLER_STATE_LKP Double-click on the header of the Expression transformation. The Edit Transformations dialog appears. Click the Rename button. Enter exp_DIM_SUPPLIER3 in the Transformation Name field and click the OK button. Click on the Ports tab. Add the following ports by clicking the Add Port button:
CHG_FLAG, Datatype=string, Prec=1(default), Port Type=Output Only INS_FLAG, Datatype=string, Prec=1(default), Port Type=Output Only CURR_DATE, Datatype=DATE, Prec=29,9, Port Type=Output Only

An expression will be needed for each of the above ports to derive the values. Open the Expression Editor and add expressions for each port as follows:
INS_FLAG= IIF(ISNULL(SUPPLIER_CD_LKP),'Y','N') CHG_FLAG =IIF(NOT ISNULL(SUPPLIER_CD_LKP)
AND CURR_SUPPLIER_STATE_LKP<>Supplier_State_SRC,'Y','N') CURR_DATE=SESSSTARTTIME

The Ports tab of the exp_SUPPLIERS_TYPE1 expression should look as follows:

11 - 6

PowerCenter 9.x Level I Developer Lab Guide

Lab. SCD TYPE3

Click the OK button. Step 2. Create a router transformation. Create a Router transformation rtr_SUPPLIERS_TYPE3. and name it

Copy/Link all of the ports from exp_SUPPLIERS_TYPE1 to rtr_SUPPLIERS_TYPE3. Edit the rtr_ODS_EMPLOYEE_TYPE transformation and select the Groups tab. Click on the Add a new group button:

Rename NEWGROUP to INSERT. Ignore the Default group; it will not be used.
The Router tests each row against every group condition, so a row can exit the transformation multiple times.

Add the following Group Filter Condition: INS_FLAG='Y' Add one more group named UPDATE. CHG_FLAG='Y'

When the row does not meet any condition, it is placed in the Default Group. The row can exit the default group if the por
ts are linked to another transformation, or simply terminate there.

If it is not the last group, select the DEFAULT group and move it to the bottom. Order does not matter to row
PowerCenter 9.x Level I Developer Lab Guide 11 - 7

Lab. SCD TYPE3

evaluation, but is helpful for clarity. Click OK.

11 - 8

PowerCenter 9.x Level I Developer Lab Guide

Lab. SCD TYPE3

Step 4. Create an update strategy transformation.

PowerCenter 9.x Level I Developer Lab Guide

11 - 9

Lab. SCD TYPE3

Create an Update Strategy transformation and name it upd_DIM_SUPPLIER3_INS. Copy/Link Supplier_Code_SRC1, Supplier_Name_SRC1 , supplier_State_SRC1 AND curr_date from INSERT group to upd_DIM_SUPPLIER1_INS. Click on the Properties tab. Add the following expression:
DD_INSERT

On the Properties tab, uncheck the Forward Rejected Rows checkbox: This keeps rejected rows from being forwarded through the mapping. They drop instead to the session log file. Step 4. Create an update strategy transformation. Create an Update Strategy transformation and name it upd_DIM_SUPPLIER3_UPD.
With the Forward Rejected Rows selected, the Informatica Server forwards the rows to the next transformation, then flags the rows for reject and ultimately writes them to the session reject file. When not selected, the Informatica Server drops rejected rows and writes them to the session log file.

Copy/Link Supplier_Code_src3, CURR_SUPPLIER_STATE_LKP3, supplier_State_SRC3 AND CURR_DATE from UPDATE group to upd_DIM_SUPPLIER3_UPD. Click on the Properties tab. Add the following expression:
DD_UPDATE

11 - 10

PowerCenter 9.x Level I Developer Lab Guide

Lab. SCD TYPE3

Step 5. Link target definition from SUPLLIERS_SCD_TYPE_UPD and SUPLLIERS_SCD_TYPE_INS.

Save the repository.

PowerCenter 9.x Level I Developer Lab Guide

11 - 11

Lab. SCD TYPE3

Exercise 3: Create and Run the Workflow

11 - 12

PowerCenter 9.x Level I Developer Lab Guide

You might also like