You are on page 1of 10

BANGALORE TECHNICAL TRAININGS Onlinetrainingsbglr@gmail.

com +917411642061

Lab 21
Reusable Worklet & Decision Task

BANGALORE TECHNICAL TRAININGS..........................1 Onlinetrainingsbglr@gmail.com.....................................1 +917411642061.................................................................1 Lab 21...............................................................................1 Lab at a Glance................................................................3 Lab at a Glance................................................................3 Objectives..............................................................3 Objectives..............................................................3 Summary................................................................3 Summary................................................................3 Duration.................................................................4 Duration.................................................................4 Exercises..........................................................................5 Exercises..........................................................................5 Exercise 1: Create a Workflow and Reusable Worklet...................................................................5
PowerCenter 9.x Level I Developer Lab Guide 21 - 1

Lab 21. Reusable Worklet & Decision Task Exercise 1: Create a Workflow and Reusable Worklet...................................................................5

21 - 2

PowerCenter 9.x Level I Developer Lab Guide

Lab 21. Reusable Worklet & Decision Task

Lab at a Glance
The exercise in this lab is designed to walk the student through the process of promoting sessions to be reusable and creating a worklet using tasks.

Objectives
After completing the lab, the student will be able to: Make existing sessions reusable. Create a worklet and incorporate into a workflow. Use a Decision task Use an E-Mail task.

Summary
A complex workflow will be utilized to solve some common decision issues encountered based on business requirements. The ETL lead would like to utilize reusable objects in complex workflows whenever possible. This workflow will need to start a session based on the status of several reusable tasks that load customer sales information. If these tasks complete successfully, then sales fact information will be loaded. If not, an advisory email will be generated (optional).

PowerCenter 9.x Level I Developer Lab Guide

21 - 3

Lab 21. Reusable Worklet & Decision Task

The completed workflow should look as follows:

Duration
This lab should take approximately 40 minutes.

21 - 4

PowerCenter 9.x Level I Developer Lab Guide

Lab 21. Reusable Worklet & Decision Task

Exercises
Exercise 1: Create a Workflow and Reusable Worklet
Step 1. Make session tasks reusable. Sessions created in a previous workflow will be moved to another workflow. They will be made reusable to do the move. Open the workflow wf_LOAD_DW_xx created in an earlier lab.
The reusable shortcut sessions are now visible in the Sessions node in the Navigator window.

On the General tab for ALL six sessions, check the Make reusable box:

A message box will appear:

Click Yes. The sessions will now be reusable:

Save.

PowerCenter 9.x Level I Developer Lab Guide

21 - 5

Lab 21. Reusable Worklet & Decision Task

Step 2. Create a reusable worklet. This reusable worklet will load sales-related information on various dimension tables using some of the new reusable sessions. It will also load other customer information not included in the original workflow. Reusable worklets are created in the Worklet Designer. Open the Worklet Designer in the Studentxx folder by
.

clicking on the Worklet Designer

button.

Create a worklet called wl_CUSTOMER_SALES_INFO_xx. Drag instances of the following five (of the six) new reusable sessions from the Sessions node of the Navigator window, into the new wl_CUSTOMER_SALES_INFO_xx worklet. The properties and connections for these sessions were set in a previous lab.
s_Shortcut_To_m_DIM_TIME_xx s_Shortcut_To_m_DIM_REP_xx s_Shortcut_To_m_DIM_VENDOR_xx s_Shortcut_To_m_DIM_CUSTOMER_xx s_Shortcut_To_m_DIM_INVOICE_xx

Open - or return to Mapping Designer. Back in the Designer, make a new shortcut mapping in the Student folder to the m_DIM_PRODUCT_xx mapping in the Shared_Student folder. Save the repository. Return to the Worklet Designer. Create a new non-reusable session task in the wl_CUSTOMER_SALES_INFO_xx worklet for the Shortcut_to_m_DIM_PRODUCT_xx mapping. Name the new session task
s_Shortcut_To_m_DIM_PRODUCT_xx.

Edit all the session tasks as follows:

On the General tab, check the Fail Parent if this task fails checkbox. On the Mapping tab: For s_Shortcut_To_m_DIM_VENDOR, set the source connection to native_source.
PowerCenter 9.x Level I Developer Lab Guide

21 - 6

Lab 21. Reusable Worklet & Decision Task

For all other session tasks, set the source connection to native_target_xx because the table being sourced is in the target database. Set the target connection to native_target_xx for all sessions. In all target properties, ensure Target load type is Normal (should be default) and select the Truncate
target table option.

Link the 6 session tasks sequentially, as follows:

Save your work. Step 3. Create a workflow. This workflow will contain the worklet load of these six dimension table loads, plus a subsequent fact table load. The fact table load will be dependent on the success of sessions in the worklet. Open the Workflow Designer in the Studentxx folder. Create a new workflow wf_FACT_SALES_xx. Step 4. Insert the worklet into the workflow. Drag an instance of the wl_CUSTOMER_SALES_INFO_xx worklet into the wf_FACT_SALES_XX workflow from the Worklets node in the Navigator window. Step 5. Create an email task (optional). The Email task will be required to execute if the reusable worklet does not succeed. (This step is optional because the environment may not be configured for email creation. The instructor will verify if this step is necessary.) Create an Email task in the wf_FACT_SALES_XX workflow called em_FAILED_CUSTOMER_SALES_INFO. Edit the Email task properties to include the following: Your email address Subject line of your choosing Desired text message

PowerCenter 9.x Level I Developer Lab Guide

21 - 7

Lab 21. Reusable Worklet & Decision Task

Step 6. Create a decision task. If the wl_CUSTOMER_SALES_INFO_xx worklet succeeds, the s_Shortcut_To_m_FACT_SALES_xx task will start. If the worklet fails, the em_FAILED_CUSTOMER_SALES_INFO Email task will start and the session will not. Create a Decision task in the wf_FACT_SALES_XX workflow and name it dec_DIM_SALES_xx. Edit the Decision task, and click on the Properties tab. Add the following value for Decision Name: $wl_CUSTOMER_SALES_INFO_xx.Status = SUCCEEDED Step 7. Insert a reusable session task. From the Navigator, drag in the reusable session s_Shortcut_To_m_FACT_SALES_xx. Step 8. Create links. Link the Start task to wl_CUSTOMER_SALES_INFO_xx. Link wl_CUSTOMER_SALES_INFO_XX to dec_DIM_SALES_xx. Link dec_DIM_SALES_xx to
s_Shortcut_To_m_FACT_SALES_xx.

Double-click the link between dec_DIM_SALES_xx and s_Shortcut_To_m_FACT_SALES_xx. Enter the expression: $dec_DIM_SALES_xx.Condition = TRUE Link dec_DIM_SALES_xx concurrently to em_FAILED_CUSTOMER_SALES_INFO (optional). Double-click the new link and enter the following expression (optional): $dec_DIM_SALES_xx.Condition = FALSE Save, validate and start wf_FACT_SALES_xx.

21 - 8

PowerCenter 9.x Level I Developer Lab Guide

Lab 21. Reusable Worklet & Decision Task

Step 9. Verify results transformation statistics for s_Shortcut_To_m_DIM_TIME_xx.

If the extra credit in Lab 18 was not run, the results will vary.

Step 10. Verify results transformation statistics for s_Shortcut_To_m_DIM_REP_xx.

Step 11. Verify results transformation statistics for s_Shortcut_To_m_DIM_VENDOR_xx.

Step 12. Verify results transformation statistics for s_Shortcut_To_m_DIM_CUSTOMER_xx.

Step 13. Verify results transformation statistics for s_Shortcut_To_m_DIM_INVOICE_xx.

PowerCenter 9.x Level I Developer Lab Guide

21 - 9

Lab 21. Reusable Worklet & Decision Task

Step 14. Verify results transformation statistics for s_Shortcut_To_m_DIM_PRODUCT_xx.

Step 15. Verify results transformation statistics for s_Shortcut_To_m_FACT_SALES_xx.

If the extra credit in Lab 18 was not run, the results will vary.

21 - 10

PowerCenter 9.x Level I Developer Lab Guide