informatica powercenter 9x level one developer lab...

284
Informatica PowerCenter 9x Level One Developer Lab Guide Version: PowerCenter 9x Level One Developer 201201

Upload: phungmien

Post on 26-May-2018

261 views

Category:

Documents


11 download

TRANSCRIPT

Page 1: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

Informatica PowerCenter 9x Level

One Developer

Lab Guide

Version: PowerCenter 9x Level One Developer 201201

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 2: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

ii

Informatica PowerCenter 9x Level One Developer 201201

Version: PowerCenter 9x Level One Developer 201201v3

January 2012

Copyright (c) 1998–2012 Informatica Corporation. All rights reserved.

This educational service, materials, documentation and related software contain proprietary information of Informatica Corporation and are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright law. Reverse engineering of the software is prohibited. No part of the materials and documentation may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording or otherwise) without prior consent of Informatica Corporation. The related software is protected by U.S. and/or international Patents and other Patents Pending.

Use, duplication, or disclosure of the related software by the U.S. Government is subject to the restrictions set forth in the applicable software license agreement and as provided in DFARS 227.7202-1(a) and 227.7702-3(a) (1995), DFARS 252.227-7013(c)(1)(ii) (OCT 1988), FAR 12.212(a) (1995), FAR 52.227-19, or FAR 52.227-14 (ALT III), as applicable.

The information in this educational service, materials and documentation is subject to change without notice. If you find any problems in this educational service, materials or documentation, please report them to us in writing.

Informatica, Informatica Platform, Informatica Data Services, PowerCenter, PowerCenterRT, PowerCenter Connect, PowerCenter Data Analyzer, PowerExchange, PowerMart, Metadata Manager, Informatica Data Quality, Informatica Data Explorer, Informatica B2B Data Transformation, Informatica B2B Data Exchange Informatica On Demand, Informatica Identity Resolution, Informatica Application Information Lifecycle Management, Informatica Complex Event Processing, Ultra Messaging and Informatica Master Data Management are trademarks or registered trademarks of Informatica Corporation in the United States and in jurisdictions throughout the world. All other company and product names may be trade names or trademarks of their respective owners.

Portions of this educational service, materials and/or documentation are subject to copyright held by third parties, including without limitation: Copyright © Adobe Systems Incorporated. All rights reserved. Copyright © Microsoft. All rights reserved. Copyright © Oracle. All rights reserved. Copyright @ the CentOS Project.

This Software is protected by U.S. Patent Numbers 5,794,246; 6,014,670; 6,016,501; 6,029,178; 6,032,158; 6,035,307; 6,044,374; 6,092,086; 6,208,990; 6,339,775; 6,640,226; 6,789,096; 6,820,077; 6,823,373; 6,850,947; 6,895,471; 7,117,215; 7,162,643; 7,243,110, 7,254,590; 7,281,001; 7,421,458; 7,496,588; 7,523,121; 7,584,422, 7,720,842; 7,721,270; and 7,774,791, international Patents and other Patents Pending.

DISCLAIMER: Informatica Corporation provides this educational services, materials and documentation “as is” without warranty of any kind, either express or implied, including, but not limited to, the implied warranties of non-infringement, merchantability, or use for a particular purpose. Informatica Corporation does not warrant that this educational service, materials, documentation or related software is error free. The information provided in this educational service, materials, documentation and related software may include technical inaccuracies or typographical errors. The information in this educational service, materials, documentation and related software is subject to change at any time without notice.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 3: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

iii

Preface Welcome to the “PowerCenter 9x Level One Developer” course.

This five-day, instructor led course introduces students to Informatica PowerCenter 9.x through lecture and hands-on exercises. The course is designed for Database Developers who are new to Informatica PowerCenter. Informatica PowerCenter is a collection of thick client workbench tools that Developers can use to create, execute, monitor and schedule ETL processes. The course will introduce attendees to working with the PowerCenter Designer, Workflow Manager, and Workflow Monitor tools, performing tasks such as creating transformations, mappings, reusable objects, sessions and workflows to extract, transform and load data. They will develop cleansing, formatting, sorting and aggregating procedures. They can learn how to use routers, update strategies, parameters /variables and overrides. This course will cover many different types of lookups, such as cached, persistent, dynamic and multiple row returns. Workflow tasks will be created to define a set of instructions for executing the ETL. Prerequisites: Prerequisites include basic familiarity with Windows GUI and at least two years’ work experience and some knowledge of SQL. Course Objectives:

Audience:

This course is designed for database developers with little or no experience of PowerCenter.

.

After successfully completing this course, students should be able to: Use Informatica Support to resolve questions and problems with PC9.x.

Use PowerCenter 9.x Designer to build mappings that extract data from a source to a target, transforming it as necessary.

Use PowerCenter transformations to cleanse, format, join, aggregate and route data to the appropriate targets

Perform error handling/trapping using PowerCenter mappings

Use PowerCenter 9.x Workflow Manager to build and run a workflow which executes a sessions associated with a mapping

Design and build simple mappings and workflows based on essential business needs.

Perform basic troubleshooting using PowerCenter logs and debugger

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 4: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

iv

Document Conventions This guide uses the following formatting conventions:

If you see… It means… Example

> Indicates a submenu to navigate to.

Click Repository > Connect. In this example, you should click the Repository menu or button and choose Connect.

boldfaced text Indicates text you need to type or enter.

Click the Rename button and name the new source definition S_EMPLOYEE.

UPPERCASE Database tables and column names are shown in all UPPERCASE.

T_ITEM_SUMMARY

italicized text Indicates a variable you must replace with specific information.

Connect to the Repository using the assigned login_id.

Note: The following paragraph provides additional facts.

Note: You can select multiple objects to import by using the Ctrl key.

Tip: The following paragraph provides suggested uses or a Velocity best practice.

Tip: The m_ prefix for a mapping name is…

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 5: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

v

Other Informatica Resources In addition to the student guides, Informatica provides these other resources:

Informatica Documentation Informatica Customer Portal Informatica web site Informatica Developer Network Informatica Knowledge Base Informatica Professional Certification Informatica Technical Support

Obtaining Informatica Documentation You can access Informatica documentation from the product CD or online help.

Visiting Informatica Customer Portal As an Informatica customer, you can access the Informatica Customer Portal site at http://communities.informatica.com The site contains product information, user group information, newsletters, access to the Informatica customer support case management system (ATLAS), the Informatica Knowledge Base, and access to the Informatica user community.

Visiting the Informatica Web Site You can access Informatica’s corporate web site at: http://www.informatica.com The site contains information about Informatica, its background, upcoming events, and locating your closest sales office. You will also find product information, as well as literature and partner information. The services area of the site includes important information on technical support, training and education, and implementation services.

Visiting the Informatica Technology Network The Informatica Developer Network is a web-based forum growing online community and interactive forum for data integration and data quality professionals around the globe. You can access the Informatica Developer Network at the following URL: http://technet.informatica.com/ The site contains information on how to create, market, and support customer-oriented add-on solutions based on interoperability interfaces for Informatica products.

Visiting the Informatica Knowledge Base As an Informatica customer, you can access the Informatica Knowledge Base at: http://communities.informatica.com The Knowledge Base lets you search for documented solutions to known technical issues about Informatica products. It also includes frequently asked questions, technical white papers, and technical tips.

Obtaining Informatica Professional Certification You can take, and pass, exams provided by Informatica to obtain Informatica Professional Certification. For more information, go to: http://www.informatica.com/products_services/education_services/certification/Pages/index.aspx

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 6: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

vi

Providing Feedback Email any comments on this guide to [email protected].

Obtaining Technical Support There are many ways to access Informatica Technical Support. You can call or email your nearest Technical Support Center listed in the following table, or you can use our WebSupport Service.

Use the following email addresses to contact Informatica Technical Support:

[email protected] for technical inquiries [email protected] for general customer service requests

WebSupport requires a user name and password. You can request a user name and password at:

http://communities.informatica.com

North America / South America

Europe / Middle East / Africa Asia / Australia

Informatica Corporation Headquarters 100 Cardinal Way Redwood City, California 94063 United States Toll Free 877 463 2435 Standard Rate United States: 650 385 5800

Informatica Software Ltd. 6 Waltham Park Waltham Road, White Waltham Maidenhead, Berkshire SL6 3TN United Kingdom Toll Free 00 800 4632 4357 Standard Rate Belgium: +32 15 281 702 France: +33 1 41 38 92 26 Germany: +49 1805 702 702 Netherlands: +31 306 022 797 United Kingdom: +44 1628 511 445

Informatica Business Solutions Pvt. Ltd. 301 & 302 Prestige Poseidon 139 Residency Road Bangalore 560 025 India Toll Free Australia: 00 11 800 4632 4357 Singapore: 001 800 4632 4357 Standard Rate India: +91 80 5112 5738

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 7: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

Table of Contents 

Lab 2.1: Create STG_Dealership Mapping .................................................................................................... 1 

Lab 2.2: Create STG Payment Mapping ...................................................................................................... 11 

Lab 2.3: Create ODS Payment Mapping ...................................................................................................... 23 

Lab 2.4: Create STG_Dealership Workflow ................................................................................................. 31 

Lab 2.5: Create STG Payment Workflow ..................................................................................................... 39 

Lab 2.6: Create ODS Payment Workflow .................................................................................................... 47 

Lab 2.7: Log Events Review ......................................................................................................................... 53 

Lab 3: TroubleShooting ............................................................................................................................... 57 

Lab 4.1: Load STG Customer Target ............................................................................................................ 71 

Lab 4.2: Load the STG Employees Target .................................................................................................... 87 

Lab 5.1: Using Homogeneous Joins to load the STG Product Target .......................................................... 99 

Lab 5.2: Using Heterogeneous Joins and Link Conditions to load the STG Transactions Target .............. 105 

Lab 6: Features and Techniques ............................................................................................................... 115 

Lab 7: Using the Debug Wizard ................................................................................................................. 121 

Lab 8.1: Using a Lookup to load the ODS Employee Target ...................................................................... 131 

Lab 8.2: Using a Sequence Generator to load ODS Dates Target ............................................................. 147 

Lab 8.3: Creating a Lookup Cache and loading the ODS Promotions Target ............................................ 153 

Lab 9: Updating Targets Using PowerCenter ............................................................................................ 161 

Lab 10.1: Using PowerCenter to load the Fact Sales Target ..................................................................... 181 

Lab 10.2: Create a Mapplet ....................................................................................................................... 193 

Lab 11: Using Workflow Variables and Tasks to load a Weekly Aggregate Target ................................... 197 

Lab 12.1: Using Parameter Files to load STG Employees Target .............................................................. 205 

Lab 12.2: Using Parameter Files to load the DIM Employees Target........................................................ 217 

Lab 13.1: Using a Dynamic Lookup and Error Logging to load the DIM Customers Target ...................... 225 

Lab 13.2: Error Handling ........................................................................................................................... 235 

Lab 14: More Lookups ............................................................................................................................... 247 

Lab 15: Mapping Workshop ...................................................................................................................... 255 

Lab 16: Workflow Workshop I .................................................................................................................. 263 

Lab 17: Workflow Workshop II ................................................................................................................. 271 

 

 

 

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 8: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

 

 

 

 

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 9: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.1 - m_STG_DEALERSHIP_xx 1

Lab 2.1: Create STG_Dealership Mapping

Scenario:

You have been asked to learn how to use Informatica PowerCenter in order to more efficiently accomplish your organization’s ETL objectives and automate the development process. Because you have limited or no prior exposure to this software, this exercise will serve to orient you to the basic development interfaces. You will create a pass-through mapping to load Dealership data from a relational source into the STG_DEALERSHIP target table.

Technical Description: PowerCenter includes two development applications, the Designer, which you will

use to create mappings, and the Workflow Manager, which you will use later to create and start workflows. This exercise is designed to serve as your first hands-on experience with PowerCenter, and supplement the instructor demonstrations. You will import source and target definitions from the database as well as create shortcuts from the Dev_Shared folder. You will create a pass-through mapping.

Goals:

Learn how to navigate the repository folder structure. Understand the purpose of the tools accessed from the Designer. Create and save source and target definitions and shortcuts. Learn how to access and edit the database connections objects. Create simple pass-through mapping.

Duration:

15 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 10: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

2 Lab 2.1- m_STG_DEALERSHIP_xx PowerCenter 9x Level I Developer

Instructions

Note: Throughout this and later exercises, xx will refer to the student number assigned to you by your Instructor or the machine you are working on. For example, if you are Student05, then DEVxx refers to the folder DEV05.

Step 1. Start PowerCenter Designer

1) On your desktop, double-click the PowerCenter Designer icon ( ) to start it.

2) In the Repository Navigator, double-click REP_EDW_DEV.

Figure 1: Double-click the Repository to open it

3) In the “Connect to Repository” dialogue:

a) For Username, enter Devxx (xx is the number assigned by your instructor).

b) For Password, enter Devxx.

c) Click Connect.

Figure 2: Connect to Repository dialogue

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 11: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.1 - m_STG_DEALERSHIP_xx 3

4) Right-click the folder labeled Devxx and select Open.

Figure 3: Open the Folder

Note: In future instructions this may be referred to as “your folder.”

Step 2. Create a Relational Source

1) From the menu, select Tools Source Analyzer. The workspace to the right of the Navigator window changes to an empty space.

Note: Note the small toolbar directly to the right of the Navigator window, at the top. There are the five Designer tools. Each tool allows you to create and modify one specific type of object, such as sources. Figure 4 shows the Designer tools with the first tool (the Source Analyzer) selected.

Figure 4: Designer Tools

2) From the menu, select Sources Import from Database.

3) The Import Tables dialog will appear.

a) Set the ODBC data source to SDBU.

b) Set the Username to SDBU.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 12: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

4 Lab 2.1- m_STG_DEALERSHIP_xx PowerCenter 9x Level I Developer

c) Owner Name and Password are SDBU as well.

d) Click the Connect button.

e) Expand the Tables node.

f) Select the DEALERSHIP table.

g) The Import Tables dialog should appear the same as displayed in Figure 5 below.

Figure 5: Completed Import Tables from Database dialog box

Note: You can select multiple objects for simultaneous import by using the Ctrl key.

h) Click OK.

The DEALERSHIP source definition will appear in the Source Analyzer workspace as shown in Figure 6 below:

Figure 6: Completed Import Tables from Database dialog box

i) Click Ctrl-S to save the source definition to the repository.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 13: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.1 - m_STG_DEALERSHIP_xx 5

View the bottom left pane of the Designer. This is the Output Window. You will see a notification that the source was successfully saved.

Figure 7: Notification of saved objects to the repository

Step 3. Create a Relational Target

1) From the Designer Tools menu, select Target Designer has shown in Figure 8.

Figure 8: Designer Tools – Target Designer

2) From the menu, select Targets Import from Database.

3) The Import Tables dialog will appear.

a) Set the ODBC data source to STG.

b) Set the Username to STG.

c) Owner Name and Password are STG as well.

d) Click the Connect button.

e) Expand the Tables node.

f) Select the STG_DEALERSHIP table.

g) The Import Tables dialog should appear the same as displayed in Figure 9 below.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 14: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

6 Lab 2.1- m_STG_DEALERSHIP_xx PowerCenter 9x Level I Developer

Figure 9: Completed Import Tables from Database dialog box

h) Click OK.

The STG_DEALERSHIP source definition will appear in the Source Analyzer workspace as shown in Figure 6 below:

Figure 10: Completed Import Tables from Database dialog box

i) Click Ctrl-S to save the target definition to the repository.

View the Output window of the Designer. You will see a notification that the source was successfully saved.

Figure 11: Notification of saved objects to the repository

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 15: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.1 - m_STG_DEALERSHIP_xx 7

Step 4. Create a Mapping

1) Open the Mapping Designer by clicking the respective icon in the toolbar. The icon is shown highlighted below:

Figure 12: Designer Tools – Target Designer

2) Select the menu option Mappings Create.

a) Delete the default mapping name and enter the name m_STG_DEALERSHIP_xx.

b) Click OK.

Velocity Best Practices: The m_ as a prefix for a mapping name is specified in the Informatica Velocity Best Practices. Mappings names should be clear and descriptive so that others can immediately understand the purpose of the mappings. Velocity suggests either the name of the targets being accessed or a meaningful description of the function of the mapping.

3) Perform the following steps in the Navigator window:

a) Expand the Sources subfolder.

b) Expand the SDBU subfolder.

c) Drag and drop the source DEALERSHIP into the mapping.

Note: Two objects will appear on the Mapping Designer. By default, the Source definition along with the Source Qualifier will by dragged out onto the workspace. This default behavior can be changed by selecting Tools Options Tables and de-selecting Create Source Qualifiers when opening sources

4) Expand the Targets subfolder, and drag and drop the target STG_DEALERSHIP onto the Mapping Designer.

a) Your mapping should appear as displayed on Figure 13:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 16: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

8 Lab 2.1- m_STG_DEALERSHIP_xx PowerCenter 9x Level I Developer

Figure 13: Mapping with Source and Target Definitions:

5) Select the SQ_DEALERSHIP Source Qualifier transformation:

a) Drag and drop the port DEALERSHIP_ID from the Source Qualifier to the DEALERHSHIP_ID port in the STG_DEALERSHIP target definition.

Tip: When linking ports in the mapping as described above, ensure that the tip of your mouse cursor is touching a letter in the name or datatype or any property of the port when dragging.

b) Connect all other ports of the Source Qualifier and the target definition as described above in the following fashion:

Figure 14: Ports to link between DEALERSHIP and STG_DEALERSHIP

SQ_DEALERSHIP DEALERSHIP

DEALERSHIP_MANAGER_ID DEALERSHIP_MANAGER_ID

DEALERSHIP_DESC DEALERSHIP_DESC

DEALERSHIP_LOCATION DEALERSHIP_LOCATION

DEALERSHIP_STATE DEALERSHIP_STATE

DEALERSHIP_REGION DEALERSHIP_REGION

DEALERSHIP_COUNTRY DEALERSHIP_COUNTRY

6) When you are done linking the ports, right-click within the mapping area and select the menu option Arrange All.

a) You mapping should appear as follows:

Figure 15: Linked m_STG_DEALERSHIP_xx Mapping

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 17: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.1 - m_STG_DEALERSHIP_xx 9

7) Type Ctrl-S to save your work to the repository.

8) Confirm that your Output window displays the message below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 18: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

10 Lab 2.1- m_STG_DEALERSHIP_xx PowerCenter 9x Level I Developer

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 19: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.2 – m_STG_PAYMENT_xx 11

Lab 2.2: Create STG Payment Mapping

Scenario:

You have been given a Payments flat file that needs to be loaded into a relational Staging Oracle table that has the same definition as the flat file. The DBA is too busy to assist at this time. You can build the relational definition using PowerCenter and execute the auto-created DDL to generate the physical table on the database.

Technical Description: The student will create the flat file source for Payments. Then a relational target

definition will be created. After this is saved to the repository, the DDL will get generated and executed on the database. The student will verify that the physical table does exist, and then create the mapping.

Goals:

Learn how to create a mapping that loads from a flat file to a relational table. Learn how to create a source definition from a flat file. Learn how to create a relational stage target from a source definition. Create a physical database table using DDL generated from PowerCenter. Create simple pass-through mapping.

Duration:

30 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 20: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

12 Lab 2.2 - m_STG_PAYMENT_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Start PowerCenter Designer

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) In the Repository Navigator, double-click REP_EDW_DEV.

Figure 1: Double-click the Repository to open it

3) In the “Connect to Repository” dialogue:

a) For Username, enter Devxx (xx is the number assigned by your instructor).

b) For Password, enter Devxx.

c) Click Connect.

Figure 2: Connect to Repository dialogue

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 21: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.2 – m_STG_PAYMENT_xx 13

4) Right-click the folder labeled Devxx and select Open.

Figure 3: Open the Folder

Note: In future instructions this may be referred to as “your folder.”

Step 2. Create a Flat File Source

1) From the menu, select Tools Source Analyzer. The workspace to the right of the Navigator window changes to an empty space.

Note: Note the small toolbar directly to the right of the Navigator window, at the top. There are the five Designer tools. Each tool allows you to create and modify one specific type of object, such as sources. Figure 4 shows the Designer tools with the first tool (the Source Analyzer) selected.

Figure 4: Designer Tools

2) Right-Click in the Source Analyzer workspace and select Clear All.

3) From the menu, select Sources Import from File.

4) The Open Flat File dialog will appear.

a) Change the drop down box Files of Type to All Files (*.*).

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 22: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

14 Lab 2.2 - m_STG_PAYMENT_xx PowerCenter 9x Level I Developer

b) Locate the c:\Infa_Shared\SrcFiles\payment.txt. If the file is located in a different directory the instructor will specify.

Figure 5: Open Flat File Dialog:

c) Click Open.

d) The Flat File Import Wizard appears.

e) Confirm that the Delimited option button is selected.

f) Select the Import Field Names from the first line checkbox.

g) The Wizard should appear as displayed below:

Figure 6: Flat File Wizard – Step 1 of 3:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 23: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.2 – m_STG_PAYMENT_xx 15

h) Click Next.

i) Confirm that only the Comma check box under Delimiters is selected.

j) Select the No Quotes button under Text Qualifier.

Figure 7: Flat File Wizard – Step 2 of 3:

k) Click Next.

l) Confirm that the field names are displayed under Column Information. These were imported from the first line of the flat file.

Figure 8: Flat File Wizard – Step 3 of 3:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 24: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

16 Lab 2.2 - m_STG_PAYMENT_xx PowerCenter 9x Level I Developer

m) Click Finish.

n) The flat file definition should appear on your Source Analyzer workspace as shown below:

Figure 9: Flat File Source Definition - Payment

Step 3. Create Target Definition from Source Definition

1) Select the Target Designer icon from the Designer Tools Toolbar above the Source Analyzer workspace as shown below:

Figure 10: Designer Tools – Target Designer:

2) Right-click anywhere in the Target Designer workspace and select Clear All.

3) In the Navigator window, open the Sources folder.

4) Open the FlatFiles subfolder

5) Select the payment source definition as shown below:

Figure 11: Navigator window – Sources FlatFile subfolder expanded:

a) Drag the source definition payment onto the Target Designer.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 25: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.2 – m_STG_PAYMENT_xx 17

b) Double-click the Target definition.

c) Select the Rename button.

d) Rename the target definition to STG_PAYMENT.

e) Select the Database Type drop down and select Oracle as shown below.

Figure 12: Target Definition – STG_PAYMENT:

f) Click OK.

g) Select Ctrl-S to save your new target definition to the repository.

h) Verify through the Output window that your Source and Target definitions saved successfully to the repository

i) Observe the Target folder of your repository folder in the Navigator window and note that the STG_PAYMENT target has been added.

Figure 13: Navigator window – Repository folder

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 26: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

18 Lab 2.2 - m_STG_PAYMENT_xx PowerCenter 9x Level I Developer

Step 4. Create the physical Payment Database table.

1) From the menu, select Targets Generate/Execute SQL.

a) Select the Connect button.

b) At the ODBC data source drop down, select STG.

c) Username is STGxx. Password is the same. As shown below:

Figure 14: ODBC Data Source:

The physical target table STG_PAYMENT will be created within the STGxx schema of your Oracle database.

a) Delete the Default Filename and enter: STG_PAYMENT_SQL_xx.sql where ‘xx’ represents your student number.

b) Select the Selected Tables radio button from the Generate From section. This will ensure that you will only create DDL for the table selected in the Target Designer workspace.

c) In the Generate Options section, select Create Table, Primary Key, Foreign Key checkboxes.

The Primary key and Foreign key are not necessary in this instance since this table does not require them. But it is a good idea to get in the habit of selecting these options. The keys will only create if they are already a part of the definition. You can edit the definition in the Target Designer and add them if you wish.

Figure 15: Database Object Generation dialog: STG_PAYMENT:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 27: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.2 – m_STG_PAYMENT_xx 19

d) Select Generate SQL file.

e) Note that the Output window confirms that the file has been created.

f) Select Edit SQL File. The file should appear as displayed below:

Figure 16: PowerCenter Generated DDL file – Payment:

g) Close the notepad file.

h) Select Execute SQL File.

i) Note the Output window confirms the creation of the physical database table.

Figure 17: Output window – Creation of Payment target table:

j) Close the Database Object Generation dialog.

Step 5. Verify the physical table exists on the database

1) Minimize all open PowerCenter applications.

2) Locate the SQL Developer shortcut on the desktop.

3) Double-click the SQL Developer icon.

Note: SQL Developer is an Oracle database editor.

a) The application should appear as shown below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 28: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

20 Lab 2.2 - m_STG_PAYMENT_xx PowerCenter 9x Level I Developer

Figure 18: SQL Developer Application:

b) Double-click INFAORCL under the connections node.

c) Expand the Other Users subfolder.

d) Expand the STGxx subfolder.

e) Click on the Tables icon within the STGxx subfolder. Then locate the STG_PAYMENT table.

f) Note that the appropriate columns exist in the table as shown in the figure below:

Figure 19: SQL Developer – STGxx.STG_PAYMENT

g) You have just verified that the physical table has been created and committed on the physical database.

h) Close the SQL Developer application.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 29: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.2 – m_STG_PAYMENT_xx 21

Step 6. Create a Mapping

1) Open the Mapping Designer by clicking the respective icon in the toolbar. The icon is shown highlighted below:

Figure 20: Designer Tools – Target Designer

2) Select the menu option Mappings Create.

a) Delete the default mapping name and enter the name m_STG_PAYMENT_xx.

3) Perform the following steps in the Navigator window:

a) Expand the Sources subfolder.

b) Expand the FlatFile subfolder.

c) Drag and drop the source PAYMENT into the mapping.

d) Expand the Targets subfolder, and drag and drop the target STG_PAYMENT onto the Mapping Designer.

4) Select the SQ_PAYMENT Source Qualifier transformation:

a) Link the ports as shown below:

Figure 21: Payment Mapping

b) Type Ctrl-S to save your work to the repository.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 30: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

22 Lab 2.2 - m_STG_PAYMENT_xx PowerCenter 9x Level I Developer

5) Confirm that your Output window displays the message below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 31: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.3 – m_ODS_PAYMENT_xx 23

Lab 2.3: Create ODS Payment Mapping

Scenario:

You have already created a workflow that extracts data from a PAYMENT flat file and loads it to an Oracle table called STG_PAYMENT. Now you must load the data from staging to the ODS (Operational Data Store) area to compete the process. You have been asked to use a repository shortcut from the DEV_SHARED folder for the target definition ODS_PAYMENT.

Technical Description: The student will create and use a shortcut to the DEV_SHARED folder for

ODS_PAYMENT. The student will then create a mapping that loads data from the STG_PAYMENT table to the ODS_PAYMENT table.

Goals:

Learn how to create a shortcut to a shared target definition. Reinforce import of relational sources lesson. Create simple pass-through mapping.

Duration:

10 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 32: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

24 Lab 2.3 – m_ODS_PAYMENT_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Start PowerCenter Designer

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) In the Repository Navigator, double-click REP_EDW_DEV.

Figure 1: Double-click the Repository to open it

3) In the “Connect to Repository” dialogue:

a) For Username, enter Devxx (xx is the number assigned by your instructor).

b) For Password, enter Devxx.

c) Click Connect.

Figure 2: Connect to Repository dialogue

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 33: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.3 – m_ODS_PAYMENT_xx 25

4) Right-click the folder labeled Devxx and select Open.

Figure 3: Open the Folder

Step 2. Create a Relational Source

1) From the menu, select Tools Source Analyzer. The workspace to the right of the Navigator window changes to an empty space.

Note: Note the small toolbar directly to the right of the Navigator window, at the top. There are the five Designer tools. Each tool allows you to create and modify one specific type of object, such as sources. Figure 4 shows the Designer tools with the first tool (the Source Analyzer) selected.

Figure 4: Designer Tools

2) Right-Click in the Source Analyzer workspace and select Clear All.

3) From the menu, select Sources Import from Database.

a) In the Import Tables dialog, enter STG for the ODBC data source.

b) Username, Owner Name and Password are STGxx.

c) Click the Connect button.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 34: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

26 Lab 2.3 – m_ODS_PAYMENT_xx PowerCenter 9x Level I Developer

d) Select the STG_PAYMENT table

e) The Import Table dialog box should appear as displayed below:

f) Click OK.

g) Click Cntl-S to save the source to the repository.

h) Verify in the Output window that source STG_PAYMENT saved successfully.

Step 3. Create Target Definition from a Shortcut

1) Select the Target Designer icon from the Designer Tools Toolbar above the Source Analyzer workspace as shown below:

Figure 5: Designer Tools – Target Designer:

2) Right-click anywhere in the Target Designer workspace and select Clear All.

3) In the Navigator window, connect to the DEV_SHARED folder using a single-click.

Note: it is important that the DEV_SHARED folder is only connected not open in order to do a shortcut. You will know that the DEV_SHARED folder is merely connected because it is not bolded and it is not listed in the folder drop down as shown in the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 35: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.3 – m_ODS_PAYMENT_xx 27

Figure 6: Connected DEV_SHARED folder:

a) Open the Targets subfolder

b) Select the ODS_PAYMENT target definition.

c) Drag and drop the ODS_PAYMENT target definition to the Devxx Target Designer workspace. You should see an icon with a curved arrow.

d) As you release the mouse button, you will see the following message:

e) Click Yes.

f) Click Ctrl-S to save the shortcut to the repository.

g) Use the Output window to verify that the shortcut saved successfully to the repository:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 36: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

28 Lab 2.3 – m_ODS_PAYMENT_xx PowerCenter 9x Level I Developer

h) The ODS_PAYMENT shortcut should appear as shown below with a small curved arrow on the upper left of the object:

4) Rename the ODS_PAYMENT shortcut.

a) Double-click the Shortcut_to_ODS_PAYMENT target definition.

b) Click the Rename button.

c) Rename the object SC_ODS_PAYMENT

d) Click Ctrl-S to save your changes to the repository.

Step 4. Create a Mapping

1) Move back to your respective repository folder, Devxx.

2) Open the Mapping Designer by clicking the respective icon in the toolbar. The icon is shown highlighted below:

Figure 7: Designer Tools – Target Designer

3) If a mapping is visible in the workspace, close it by selected menu option Mappings Close.

4) Select the menu option Mappings Create.

a) Delete the default mapping name and enter the name m_ODS_PAYMENT_xx.

5) Perform the following steps in the Navigator window:

a) Expand the Sources subfolder.

b) Expand the STG subfolder.

c) Drag and drop the source STG_PAYMENT into the mapping.

d) Expand the Targets subfolder, and drag and drop the target SC_ODS_PAYMENT onto the Mapping Designer.

e) Link the ports as shown below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 37: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.3 – m_ODS_PAYMENT_xx 29

Figure 8: ODS_Payment Mapping

f) Type Ctrl-S to save your work to the repository.

6) Use your Output window to confirm the mapping saved successfully to the repository.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 38: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

30 Lab 2.3 – m_ODS_PAYMENT_xx PowerCenter 9x Level I Developer

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 39: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2. 4 - wf_m_STG_DEALERSHIP_xx 31

Lab 2.4: Create STG_Dealership Workflow

Scenario:

You have been asked to learn how to use Informatica PowerCenter in order to more efficiently accomplish your organization’s ETL objectives and automate the development process. Because you have limited or no prior exposure to this software, this exercise will serve to orient you to the basic development interfaces. You will create a workflow with relational connections to load Dealership data from a relational source into the STG_DEALERSHIP target table.

Technical Description: PowerCenter includes two development applications, the Designer, which you have

already used create mappings, and the Workflow Manager, which you will use to create and start workflows. This exercise is designed to serve as your first hands-on experience with PowerCenter, and supplement the instructor demonstrations.

Goals:

Understand the purpose of the tools accessed from the Workflow Manager. Create Session tasks to run the mappings and configure connectivity. Create Workflows to run the Session tasks. Execute the Workflows and monitor the results.

Duration:

15 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 40: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

32 Lab 2.4 - wf_m_STG_DEALERSHIP_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Workflow and a Session Task

1) Launch the Workflow Manager by clicking on the respective icon in the toolbar. The icon is shown highlighted below:

Figure 1: Workflow Manager Icon:

2) Open the Workflow Designer workspace by clicking the respective icon in the toolbar. The icon is shown highlighted below:

Figure 2: Workflow Designer Workspace

3) Select the menu option Workflows Create.

a) Delete the default workflow name and enter wf_m_STG_DEALERSHIP_xx.

b) Click OK.

c) The Start Task will appear on your workspace.

4) Adjust position of the Tasks Toolbar

a) Your Tasks Toolbar could be hanging off the top right side of the Workflow Manager as shown below:

Figure 3: Re-position Task Toolbar:

b) Grab the handle of the Task Toolbar and pull it to the left so that it is easily accessible.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 41: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2. 4 - wf_m_STG_DEALERSHIP_xx 33

5) Create the Session task.

a) Click on the Session icon on the toolbar. The icon is shown highlighted below:

Figure 4: Session Task Icon:

6) Click on the Workflow Designer workspace.

a) The Mappings List dialog with a list of mappings to associate with your session task will appear. Choose the m_STG_DEALERSHIP_xx mapping.

b) Click OK.

c) Select the Link tool from the toolbar. The Link icon is hightlighted below:

Figure 5: Link Icon on the Toolbar:

d) Select the Start Task and drag the link to the Session task.

e) When completed the workflow should appear as follows:

Figure 6: wf_m_STG_DEALERSHIP workflow:

f) Double-click the session task to open it in edit mode.

(i) Select the Mapping tab.

(ii) Select the Source Qualifier icon SQ_DEALERSHIP (in the Session properties navigator window).

(iii) In the Connections area on the right, select the drop down arrow under SQ_DEALERSHIP – DB Connection.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 42: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

34 Lab 2.4 - wf_m_STG_DEALERSHIP_xx PowerCenter 9x Level I Developer

(iv) The Relational Connection Browser will appear. Select the Oracle connection SDBU.

Figure 7: Relation Connection Browser:

(v) Click OK.

g) Select the STG_DEALERSHIP target under the Targets node.

h) In the Connections area on the right, select the drop down arrow under DB Connections section.

i) The Relational Connection Browser will appear. Select the Oracle

connection STGxx.

j) Click OK.

k) In the Properties section, change the Target Load Type to Normal as shown

below.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 43: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2. 4 - wf_m_STG_DEALERSHIP_xx 35

Figure 8: Edit Tasks – Target Properties

l) Select Connections on the left side of the Edit Tasks screen. The screen should appear as shown below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 44: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

36 Lab 2.4 - wf_m_STG_DEALERSHIP_xx PowerCenter 9x Level I Developer

Figure 9: Edit Tasks Dialog for s_m_STG_DEALERSHIP_xx:

m) Click OK.

n) Click Ctrl-S to save the workflow to the repository.

7) Start the Workflow.

a) Right-click anywhere in the Workflow Designer workspace and select Start Workflow.

b) The Workflow Monitor will open. Select the Task View tab at the bottom of the interface.

c) Right-click on s_m_STG_DEALERSHIP_xx and select Get Run Properties.

Figure 10: Workflow Monitor – wf_m_STG_DEALERSHIP_xx

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 45: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2. 4 - wf_m_STG_DEALERSHIP_xx 37

The completed session run properties should display as shown below:

Figure 11: Run Properties – s_m_STG_DEALERSHIP_xx

Step 2. Data Results

1) In the Designer, you can view data that was loaded into the target.

a) Right-click on the STG_DEALERSHIP target definition.

b) Select Preview Data.

c) Set the ODBC Data Source to STG.

d) Enter the user name STGxx.

e) Enter the password STGxx and click the Connect button.

f) Your data should appear as displayed below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 46: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

38 Lab 2.4 - wf_m_STG_DEALERSHIP_xx PowerCenter 9x Level I Developer

Figure 12: Data Preview of the STG_DEALERSHIP target table:

Congratulations! You’ve just completed your first PowerCenter workflow.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 47: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.5 – wf_m_STG_PAYMENT_xx 39

Lab 2.5: Create STG Payment Workflow

Scenario:

You have created a mapping which loads a Payments flat file into a relational Staging Oracle table. You now need to create a workflow which will contain the location of the flat file for the source as well as the connection for the relational target table.

Technical Description: The student will create the workflow for STG_Payments.

Goals:

Understand the purpose of the tools accessed from the Workflow Manager. Create Session tasks to run the mappings and configure connectivity. Create Workflows to run the Session tasks. Execute the Workflows and monitor the results.

Duration:

15 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 48: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

40 Lab 2. 5 – wf_m_STG_PAYMENT_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Workflow and a Session Task

1) If you are not already logged into the Workflow Manager, launch the application by clicking on the respective icon in the toolbar. The icon is shown highlighted below:

Figure 1: Workflow Manager Icon:

2) Open the Workflow Designer workspace by clicking the respective icon in the toolbar. The icon is shown highlighted below:

Figure 2: Workflow Designer Workspace

3) If a workflow already exists within the workspace, select menu option Workflows Close.

4) Select the menu option Workflows Create.

a) Delete the default workflow name and enter wf_m_STG_PAYMENT_xx.

b) Click OK.

5) Create the Session task.

a) Click on the Session icon on the toolbar.

b) Click on the Workflow Designer workspace.

c) The Mappings List dialog with a list of mappings to associate with your session task will appear. Choose the m_STG_PAYMENT_xx mapping.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 49: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.5 – wf_m_STG_PAYMENT_xx 41

d) Click OK.

e) Link the Start task to the session s_m_STG_PAYMENT_xx.

f) When completed the workflow should appear as follows:

Figure 3: wf_m_STG_PAYMENT_xx workflow:

g) Double-click the session task to open it in edit mode.

(i) Select the Mapping tab.

(ii) Select the Source Qualifier icon SQ_PAYMENT (in the Session properties navigator window).

(iii) Scroll down in the Properties section on the right-side of the Edit Tasks

window. Make sure the Source File Directory is set to $PMSourceFileDir \ and the Source FileName is set to payment.txt as shown in the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 50: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

42 Lab 2. 5 – wf_m_STG_PAYMENT_xx PowerCenter 9x Level I Developer

Figure 4: Mapping Tab of s_m_STG_PAYMENT_xx Session:

Note: $PMSourceFileDir\ is the PowerCenter variable which currently points to c:\infa_shared\SrcFiles. This variable can be changed in the PowerCenter Administrator tool.

h) Select the STG_PAYMENT target under the Targets node.

i) In the Connections area on the right, select the drop down arrow under DB Connections section.

j) The Relational Connection Browser will appear. Select the Oracle

connection STGxx.

k) Click OK.

l) In the Properties section, change the Target Load Type to Normal as shown below.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 51: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.5 – wf_m_STG_PAYMENT_xx 43

Figure 5: Edit Tasks – Target Properties

m) Select Connections on the left side of the Edit Tasks screen. The screen should appear as shown below:

Figure 6: Edit Tasks Dialog for s_m_STG_PAYMENT_xx:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 52: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

44 Lab 2. 5 – wf_m_STG_PAYMENT_xx PowerCenter 9x Level I Developer

n) Click OK.

o) Click Ctrl-S to save the workflow to the repository.

6) Start the Workflow.

a) Right-click anywhere in the Workflow Designer workspace and select Start Workflow.

b) Right-click on s_m_STG_PAYMENT _xx and select Get Run Properties.

Figure 7: Run Properties – s_m_STG_PAYMENT_xx

Step 2. Data Results

1) In the Designer, you can view data that was loaded into the target.

a) Right-click on the STG_PAYMENT target definition.

b) Select Preview Data.

c) Set the ODBC Data Source to STG.

d) Enter the user name STGxx.

e) Enter the password STGxx and click the Connect button.

f) Your data should appear as displayed below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 53: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.5 – wf_m_STG_PAYMENT_xx 45

Figure 8: Data Preview of the STG_PAYMENT target table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 54: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

46 Lab 2. 5 – wf_m_STG_PAYMENT_xx PowerCenter 9x Level I Developer

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 55: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.6 – wf_m_ODS_PAYMENT_xx 47

Lab 2.6: Create ODS Payment Workflow

Scenario:

You need to create a workflow which loads payment data from staging to the ODS (Operational Data Store) area.

Technical Description: The student will create a workflow that loads data from the STG_PAYMENT table to

the ODS_PAYMENT table.

Goals:

Create Session tasks to run the mappings and configure connectivity. Create Workflows to run the Session tasks. Execute the Workflows and monitor the results.

Duration:

10 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 56: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

48 Lab 2. 6 – wf_m_ODS_PAYMENT_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Workflow and a Session Task

1) If you are not already logged into the Workflow Manager, launch the application by clicking on the respective icon in the toolbar. The icon is shown highlighted below:

Figure 1: Workflow Manager Icon:

2) Open the Workflow Designer workspace by clicking the respective icon in the toolbar. The icon is shown highlighted below:

Figure 2: Workflow Designer Workspace

3) If a workflow already exists within the workspace, select menu option Workflows Close.

4) Select the menu option Workflows Create.

a) Delete the default workflow name and enter wf_m_ODS_PAYMENT_xx.

b) Click OK.

5) Create the Session task.

a) Click on the Session icon on the toolbar.

b) Click on the Workflow Designer workspace.

c) The Mappings List dialog with a list of mappings to associate with your session task will appear. Choose the m_ODS_PAYMENT_xx mapping.

d) Click OK.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 57: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.6 – wf_m_ODS_PAYMENT_xx 49

e) Link the Start task to the session s_m_ODS_PAYMENT_xx.

f) When completed the workflow should appear as follows:

Figure 3: wf_m_ODS_PAYMENT_xx workflow:

g) Double-click the session task to open it in edit mode.

(i) Select the Mapping tab.

(ii) Select the Source Qualifier icon SQ_STG_PAYMENT (in the Session properties navigator window).

(a) SQ_STG_PAYMENT – DB Connection = STGxx

(iii) Select the Target SC_ODS_PAYMENT (in the Session properties navigator window).

(a) The target connection = ODSxx.

(b) Change the Target Load Type to Normal.

(iv) Select the Connections node. Your screen should appear as displayed below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 58: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

50 Lab 2. 6 – wf_m_ODS_PAYMENT_xx PowerCenter 9x Level I Developer

Figure 4: Mapping Tab of Session Task – s_m_ODS_PAYMENT_xx:

h) Click OK.

i) Click Ctrl-S to save the workflow to the repository.

6) Still in the Workflow Manager , , Start the Workflow.

a) Right-click anywhere in the Workflow Designer workspace and select Start Workflow.

7) In the Workflow Monitor , right-click on s_m_ODS_PAYMENT_xx and select Get Run Properties.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 59: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.6 – wf_m_ODS_PAYMENT_xx 51

Figure 5: Run Properties – s_m_ODS_PAYMENT_xx

Step 2. Data Results

1) In the Designer, you can view data that was loaded into the target.

a) Right-click on the SC_ODS_PAYMENT target definition.

b) Select Preview Data.

c) Set the ODBC Data Source to ODS.

d) Enter the user name ODSxx.

e) Enter the password ODSxx and click the Connect button.

f) Your data should appear as displayed below:

Figure 6: Data Preview of the SC_ODS_PAYMENT target table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 60: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

52 Lab 2. 6 – wf_m_ODS_PAYMENT_xx PowerCenter 9x Level I Developer

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 61: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.7 53

Lab 2.7: Log Events Review

Scenario:

Your workflows have completed successfully. However, you still feel you should familiarize yourself with the logging functions of PowerCenter.

Technical Description: The student will use the Workflow Monitor to access the Workflow and Session logs

of the last workflow and familiarize themselves with all the valuable information included there.

Goals:

Learn how to access the Workflow and Session logs in the Workflow Monitor. Identify memory allocations. Learn location of workflow names, folder names, and Integration Service names

within both workflow and session logs. Identify SQL Statements.

Duration:

15 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 62: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

54 Lab 2.7 PowerCenter 9x Level I Developer

Instructions

Step 1. Access the Workflow and Session Logs

If you are not already logged into the Workflow Monitor, launch the application by clicking on the respective icon in the toolbar.

1) The wf_m_ODS_PAYMENT_xx workflow should already be open within the workspace.

2) Right-click the wf_m_ODS_PAYMENT_xx and select the menu option Get Workflow Log.

3) The Workflow Log Events dialog opens

a) Identify the run_id for the workflow.

b) Note that the Link between the Start Task and the Session s_m_ODS_PAYMENT_xx has an empty expression. There will be more on link expressions in a later module.

c) Note the name of the node in which the session instance was executed.

d) Note the name of the domain and the name of the user who executed the workflow.

e) Note the notification of successful execution of both the session and the workflow.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 63: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 2.7 55

f) Close the Workflow Log Events dialog.

4) Right-click the s_m_ODS_PAYMENT_xx session

Figure 1: PowerCenter Workflow Monitor – s_m_ODS_PAYMENT_xx:

5) Select the menu option Get Session Log.

6) The Session Log Events dialog opens.

a) Note the name of the Repository, Integration Service, Folder, Workflow and mapping for this session run.

b) Note that this session was executed by a 32-bit Integration Service, the name of the node and version of the software.

c) Note that the commit is target-based and that the commit interval is 10,000. This can be changed on the properties of the session.

d) Note the SQL Insert Statement for the target and that there is currently not a primary key on the table, therefore updates are not supported.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 64: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

56 Lab 2.7 PowerCenter 9x Level I Developer

7) Scroll down a bit on the log.

a) Note the start of the session and the target table listed.

b) Note the SQL Query against the source.

c) Note the start and end times of the session

d) Note the Load Summary and the number of inserts, applied, rejected and affected records.

8) Close the Session Events Log.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 65: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 3 Troubleshooting 57

Lab 3: TroubleShooting

Scenario:

Now that you have some experience, your Tech Lead has given you three flawed workflows that have errors in need of correction.

Technical Description: The student will copy mappings from the DEV_SHARED folder and correct the

errors associated with them.

Goals:

Learn how to copy mappings and workflows from a shared area. Identify errors within a mapping and workflow. Learn how to use the PowerCenter interfaces and logs to identify errors. Learn how to correct the errors in the mapping associated with a workflow.

Duration:

45 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 66: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

58 Lab 3 Troubleshooting PowerCenter 9x Level I Developer

Instructions

Step 1. Start the PowerCenter Repository Manager

1) From within the PowerCenter Designer, please click the PowerCenter Repository Manager icon the toolbar to start it.

2) PowerCenter will log you into the Repository Manager with the Devxx login used to log into the Designer.

3) PowerCenter will automatically open your folder.

4) Double-Click the Dev_Shared folder to open it.

5) Expand the Workflows subfolder of the Dev_Shared folder.

6) Select the wf_m_Errors1_xx workflow as shown below.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 67: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 3 Troubleshooting 59

Figure 1: Dev_Shared wf_m_Errors1_xx Workflow:

7) Copy the Workflow

a) Select menu option Edit Copy.

b) Select your Devxx Folder.

c) Select the menu option Edit Paste.

d) You will see the following confirmation message:

Figure 2: Workflow Copy Confirmation:

e) Click Yes.

f) Note the Copy Messages in the Output Window of the Repository Manager.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 68: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

60 Lab 3 Troubleshooting PowerCenter 9x Level I Developer

Figure 3: Copy Messages in Output Window:

g) Expand the Sources, Targets, Mappings and Workflows subfolders of your

Devxx folder.

(i) Transactions should have been added as a Source.

(ii) ODS_Transactions should have been added as a Target.

(iii) m_Errors1_xx mapping should have been added.

(iv) wf_m_Errors1_xx workflow should have been added.

h) Repeat the copy workflow steps for wf_m_Error2_xx and wf_m_Error3_xx workflows.

8) Rename the Mapping

a) Navigate back to the PowerCenter Designer.

b) Right-Click on your folder and select Disconnect.

c) Right-Click on your folder and select Open.

d) Note that the Error Mappings, Sources and Targets now exist in your folder.

e) Open the each mapping in the Mapping Designer workspace.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 69: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 3 Troubleshooting 61

f) Select the menu option Mappings Edit.

g) Rename each mapping so that the xx is your Student id.

h) Click OK.

i) Click Ctrl-S to save your work to the repository.

j) Use the Output window to verify the mapping saved successfully to the

repository.

Step 2. Start the Workflow Manager

1) If you are not already logged into the Workflow Manager, launch the application by clicking on the respective icon in the toolbar.

2) Log into the Repository with your Devxx login.

3) Open your folder.

4) Navigate to the Workflow Designer using the Workflow Tools Toolbar.

5) If a workflow exists on the workspace, use menu option Workflows Close to clear the workspace.

6) Right-Click on your folder and select Disconnect.

7) Right-Click on your folder and select Open.

8) Note that the Errors Workflows are now listed in your folder

9) Rename the Workflow

a) Open each Errors workflow in the Workflow Designer workspace.

b) Select the menu option Workflow Edit.

c) Rename the Workflow so that the xx is your Student id.

d) Right-click on the session and select Edit.

e) Rename the session so that the xx reflects your student id.

f) Click OK.

g) Click Ctrl-S to save your work to the repository.

h) Use the Output window to verify the mapping saved successfully to the repository.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 70: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

62 Lab 3 Troubleshooting PowerCenter 9x Level I Developer

Step 3. Trouble Shoot a Session Failure

1) Use the drop down list next to the Workflow Designer Toolbar to open wf_m_Errors1_xx as shown in the figure below:

Figure 4: Workflow list drop down:

2) Edit the Session to use correct relational connections

a) Each session needs to be edited to contain the relational connection associated with your student id.

b) Double-click the s_m_Errors1_xx session task.

c) Select the Mapping Tab.

d) Select SQ_TRANSACTIONS. Scroll down in the properties and change the

Source File Name to sales_transactions.txt.

e) Select the ODS_TRANSACTIONS target and ensure the ODSxx is the

relational connection.

f) Set the Target Load Type to Normal.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 71: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 3 Troubleshooting 63

g) Click OK.

3) Start Workflow wf_m_Errors1_xx

4) Note that the session has failed.

a) Right-click on the session task and select Get Run Properties.

b) Note the Attribute Value of 0.

c) Expand the Task Details of the Session Run Properties

d) Locate the Status Message. TM_6190 Cannot identify the unique relational connection or application connection that is used as $Source or $Target for a Lookup or a Stored Procedure transformation.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 72: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

64 Lab 3 Troubleshooting PowerCenter 9x Level I Developer

e) Right-click on the s_m_Errors1_xx session and select Get Session Log.

Note the error message:

5) When there is no Session Log, the next thing to do is look at the Workflow Log.

a) In the Workflow Monitor, right-click the Workflow to obtain Workflow Log.

b) Note that the Workflow log shows the same error as the Session Task Details and other errors as well.

c) Correct the Connection problems in the session.

Hint: This is usually due to a Lookup transformation that defaults to $Source or $Target.

6) Double-click the s_m_Errors1_xx session task and select the Mapping tab.

a) Select the connections node on the left-side of the interface.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 73: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 3 Troubleshooting 65

Note: The lookups access the Product_Cost and Payment_ID tables in the SDBU schema. The lookups are set to use the $Source connection variable. However, this variable is currently undefined.

b) Edit the session and set $Source to connection SDBU in the Connections

node of the navigation panel. As shown below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 74: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

66 Lab 3 Troubleshooting PowerCenter 9x Level I Developer

c) Click OK.

d) Click Ctrl-S to save your work to the repository.

e) Execute the workflow.

f) Note that the workflow succeeded.

g) Right-click on the session and select Get Run Properties.

h) Your screen should appear as the figure displayed below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 75: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 3 Troubleshooting 67

Step 4. Debugging an Unknown Error

1) Drag the workflow wf_Error2_xx onto the Workflow Manager Workflow Designer workspace.

2) Edit the session task

(i) Select the Mapping tab.

(ii) Select the Source Qualifier icon SQ_EMPLOYEE_DEALERSHIP (in the Session properties navigator window).

(a) SQ_ EMPLOYEE_DEALERSHIP – DB Connection = STGxx

(iii) Save the workflow to the repository.

3) Start the workflow

4) The workflow will fail with this error: ‘zero iteration count’ as illustrated in the figure from the session log below:

Figure 5: “Zero Iteration Count’ error:

Note: It’s possible to look at the First Error Attribute Value and get some direction on where to look for the problem.

DEALERSHIP. DEALERSHIP _id = MRKT_EMPLOYEES.DEALERSHIP_ID seems to be causing the issue.

Lets open the mapping and take a look at the SQL relationship.

5) Maximize the PowerCenter Designer.

6) Open the m_Errors2_xx mapping.

7) Double-click the source qualifier SQ_EMPLOYEE_DEALERSHIP.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 76: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

68 Lab 3 Troubleshooting PowerCenter 9x Level I Developer

8) Click on the Properties tab.

Note that the relationship has been entered into the SQL Query value. That is wrong. A relationship declaration should be entered into the User Defined Join value.

9) Correct the mapping as shown below:

10) Click OK.

11) Save your work to the repository.

12) Maximize the Workflow Manager.

13) Start the wf_m_Errors2_xx workflow.

14) A successful execution will result in Task Details and Source/Target Statistics

like the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 77: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 3 Troubleshooting 69

Figure 6: Successful Execution of s_m_Errors2_xx Session:

Step 5. Debugging an Oracle Error

1) Drag the workflow wf_Error3_xx onto the Workflow Manager Workflow Designer workspace.

2) Edit the session task

(i) Select the Mapping tab.

(ii) Select Connections (in the Navigator window).

(iii) Select the following lookup transformations and set their connections as indicated.

Object Type Object Name Connection Name

Lookup DIM_DATES_WEEK_MONTH EDWxx

Target ODS_SALES_TOTAL_WEEKLY ODSxx

Target ODS_SALES_TOTAL_MONTHLY ODSxx

(iv) Save the workflow to the repository.

3) Start the workflow.

4) The workflow fails with error: ‘ORA-26002: Table ODS.ODS_SALES_TOTAL has index defined upon it.’ as shown in the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 78: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

70 Lab 3 Troubleshooting PowerCenter 9x Level I Developer

Figure 7: Session Failure with Database error:

5) Note: a session will fail if the target table has an index on it and the Target Load Type of the session is set to ‘Bulk’.

6) Correct the Session.

7) Save your work to the repository.

8) Execute the workflow.

9) A successful execution will result in Task Details and Source/Target Statistics

like the figure below:

Figure 8: Successful execution of session s_m_Errors3_xx:

Alternatively, you could have used the pre/post SQL in the mapping/session to drop and rebuild the indexes during a session run.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 79: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.1 – m_STG_Customer_Contacts_xx 71

Lab 4.1 Load STG Customer Target

Scenario:

The staging area for Mersche Motors data warehouse has a customer contacts table. Mersche Motors receives new data from their regional sales office daily in the form of three text files. The text files are identical. For processing simplicity, Mersche Motors will be making use of the PowerCenter ability to read a list of files from a single source.

Technical Description: PowerCenter will source from a file list. This file list contains the names of three

delimited flat files from the regional sales offices. All rows with a customer number 99999 will need to be filtered out. There are a number of columns that will need to have the data reformatted, this will include substrings, concatenation and decodes.

Goals:

Create a filter transformation to eliminate unwanted rows form a flat file source. Create an Expression transformation to reformat incoming rows before they are

written to a target. Use the DECODE function as a small lookup to replace values for incoming data

before writing to target. Create a session task that will accept and process a file list as a source. Create a workflow

Duration:

60 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 80: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

72 Lab 4.1 – m_STG_Customer_Contacts_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Flat File Source Definition

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) Log into the Repository with your Devxx login.

3) Open your folder.

4) Navigate to the Mapping Designer using the Designer Tools Toolbar.

5) Open the Source Analyzer workspace and select Clear All.

a) Import the customer_layout.dat flat file definition. This file is located in the C:\Infa_Shared\SrcFiles directory. If the file is located in a different directory, your instructor will specify.

b) Ensure that the following parameters are selected:

(i) Import field names from the first line.

(ii) Comma delimited flat file.

(iii) Text Qualifier is Double Quotes

(iv) Format of the Date field is Datetime.

c) Confirm that your source definition appears as displayed in the following figure:

Figure 1: Flat File Definition: Customer_Layout:

Tip: Only one flat file definition is required when using a file lit as a source in PowerCenter. All the files that make up the file list must have the same identical layout in order for the file list to be successfully processed by PowerCenter.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 81: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.1 – m_STG_Customer_Contacts_xx 73

d) Click Ctrl-S to save your work to the repository.

Step 2. Create a Relational Target Definition

1) Create a shortcut to the STG_CUSTOMERS definition from the DEV_SHARED folder in your folder. Name the shortcut SC_STG_CUSTOMERS.

2) Confirm that your target definition appears the same as displayed in the figure below:

Figure 2: Target Shortcut – SC_STG_CUSTOMERS:

Step 3. Create a mapping

1) Open the Mapping Designer.

2) If a mapping is visible in the workspace, close it by selected menu option Mappings Close.

3) Create a new mapping named m_STG_CUSTOMER_CONTACTS_xx.

4) Add the customer_layout file source to the mapping

5) Add SC_STG_CUSTOMER target to the mapping.

6) Your mapping will appear similar to the figure below

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 82: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

74 Lab 4.1 – m_STG_Customer_Contacts_xx PowerCenter 9x Level I Developer

Figure 3: Mapping with Source and Target Definition:

Step 4. Create a Filter Transformation

1) It has been determined that there are certain erroneous records that exist at the source that should be filtered out of the data stream so that they don’t get loaded to the target. The data condition to be tested for? Records with a customer number of 99999 or records with null customer numbers. The Filter transformation is the perfect object for this operation. If your source were relational, you could use the Source Filter on the Source Qualifier transformation to achieve the same results.

2) Select the Filter transformation tool button located on the Transformation tool bar and place it in the workspace between the Source Qualifier and the Target. The icon is shown highlighted below:

Figure 4: Transformation Toolbar:

3) Your mapping will appear similar to the following figure

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 83: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.1 – m_STG_Customer_Contacts_xx 75

4) Link the following ports from the Source Qualifier to the Filter:

CUSTOMER_NO

FIRSTNAME

LASTNAME

ADDRESS

CITY

STATE

ZIP

COUNTRY

PHONE_NUMBER

GENDER

INCOME

EMAIL

AGE

5) Edit the Filer transformation

a) Rename it to fil_CUSTOMER_NO_99999

b) Select the Properties tab.

c) Your display will appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 84: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

76 Lab 4.1 – m_STG_Customer_Contacts_xx PowerCenter 9x Level I Developer

Figure 5: Properties Tab of the Filter Transformation:

6) Click the dropdown arrow for the Filter Condition Transformation Attribute to active the Expression Editor.

7) Remove the TRUE condition from the Expression Editor.

8) Enter the following expression:

a) CUSTOMER_NO != 99999 OR ISNULL(CUSTOMER_NO)

9) Click OK to return to the Properties of the Filter transformation

a) The Properties will appear as displayed in the figure below:

10) Click OK.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 85: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.1 – m_STG_Customer_Contacts_xx 77

Step 5. Create an Expression Transformation

1) Create an Expression transformation directly after the Filter transformation. Select the Expression transformation tool button located on the Transformation tool bar and place it in the workspace directly after the Filter. The icon is shown highlighted below:

2) Select the following ports from the Filter transformation and pass them to the Expression transformation:

FIRSTNAME

LASTNAME

PHONE_NUMBER

GENDER

AGE

3) Your mapping will appear similar to the figure below:

4) Edit the Expression transformation

a) Rename it exp_FORMAT_NAME_GENDER_PHONE.

b) Change the port type to input for all of the ports except AGE.

c) Prefix each of these input ports with IN_.

5) Create Output Ports

a) Create a new output port after the AGE port by positioning the cursor on the AGE port and clicking the add icon.

b) Enter the information as follows:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 86: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

78 Lab 4.1 – m_STG_Customer_Contacts_xx PowerCenter 9x Level I Developer

Port Name Datatype Precision Expression

OUT_CUST_NAME String 41 IN_FIRSTNAME || ‘ ‘ || IN_LASTNAME

This new port will concatenate the FIRSTNAME and LASTNAME ports into a single string. Do not use the CONCAT in expressions. Use || to achieve concatenation. The CONCAT function is only available for backward compatibility.

Velocity Best Practice: Prefixing input only ports with IN_ and output ports with OUT_ is a Velocity Best Practice. This makes it easier to tell what the ports are without having to open the transformation.

c) Create a new output port after the OUT_CUST_NAME port. It should be called OUT_CUST_PHONE.

Port Name Datatype Precision Expression

OUT_CUST_PHONE String 14 '(' || SUBSTR(TO_CHAR(in_PHONE_NUMBER), 1, 3) || ') ' || SUBSTR(TO_CHAR(in_PHONE_NUMBER), 4, 3) || '-' || SUBSTR(TO_CHAR(in_PHONE_NUMBER), 7, 4)

The expression above uses nesting to call the TO_CHAR function from within the SUBSTR function. The TO_CHAR function is performed first. The SUBSTR function is then performed against the return value from TO_CHAR.

d) Create a new output port after the OUT_CUST_PHONE port. It should be named OUT_GENDER.

Port Name Datatype Precision Expression

OUT_GENDER String 6 DECODE(in_GENDER, 'M', 'MALE', 'F', 'FEMALE', 'UNK')

The DECODE function used in this previous expression can be used to replace nested IIF functions or small static lookup tables. The DECODE expression in the previous step will return the value MALE if the incoming port GENDER is equal to M, FEMALE if GENDER equals F, or UNK if GENDER equals anything besides F or M.

e) Create a new output port after the OUT_GENDER port

Port Name Datatype Precision Expression

OUT_AGE_GROUP String 14 DECODE(TRUE, AGE < 20, 'LESS THAN 20', AGE >= 20 AND AGE <= 29, '20 TO 29', AGE >= 30 AND AGE <= 39, '30 TO 39', AGE >= 40 AND AGE <= 49, '40 TO 49', AGE >= 50 AND AGE

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 87: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.1 – m_STG_Customer_Contacts_xx 79

<= 60, '50 TO 60', AGE > 60, 'GREATER THAN 60')

This DECODE function assigns the appropriate age group level to each customer based on their age. DECODE used in this manner tests multiple columns and conditions, evaluated in a top to bottom order for TRUE or FALSE.

f) Click OK.

6) Link the Expression Transformation to the Target .

exp_FORMAT_NAME_GENDER_PHONE SC_STG_CUSTOMER

AGE CUST_AGE

OUT_CUST_NAME CUST_NAME

OUT_CUST_PHONE CUST_PHONE_NMBR

OUT_GENDER CUST_GENDER

OUT_AGE_GROUP CUST_AGE_GROUP

7) Link the Filter Transformation to the Target.

fil_CUSTOMER_NO_99999 SC_STG_CUSTOMER

CUSTOMER_NO CUST_ID

ADDRESS CUST_ADDRESS

CITY CUST_CITY

STATE CUST_STATE

ZIP CUST_ZIP

COUNTRY CUST_COUNTRY

INCOME CUST_INCOME

EMAIL CUST_E_MAIL

a) Your mapping should appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 88: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

80 Lab 4.1 – m_STG_Customer_Contacts_xx PowerCenter 9x Level I Developer

b) Save your work.

c) Verify that the mapping is valid.

d) Right-click in the workspace and select Arrange all Iconic.

e) Your mapping should appear similar to the following figure:

Figure 6: Iconic View of the Completed Mapping:

Step 6. Create and run the workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) Here is a shortcut to creating a workflow

a) If there is a workflow open in the workspace, close it.

b) Click on the session task on the tool bar.

c) Click on the empty workspace.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 89: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.1 – m_STG_Customer_Contacts_xx 81

d) A list of available mappings (in this case, choose m_STG_CUSTOMER_CONTACTS_xx) should automatically appear.

e) After choosing the mapping, the workflow will be automatically created for you using the name of the mapping (wf_m_STG_CUSTOMER_CONTACTS_xx). The start task will appear already linked to the properly named session. Good stuff!

3) Edit the s_m_STG_CUSTOMER_CONTACTS_xx session.

4) Under the Mapping tab:

a) Select the SQ_customer_layout located under the Sources folder in the navigator window.

b) Confirm the Source file directory is set to $PMSourceFileDir\.

c) In Properties | Attribute | Source Filename type in customer_list.dat.

Tip: The source instance you are reading is known as a File List. It is a list of files which will be appended together and treated as one source file by PowerCenter. The name of the text file that is listed in Properties | Attributes | Source Filename will be a test file that contains a list of the test files to be read in as individual sources. When you create a file list you open a blank test file with an application such as Notepad and type on a separate line each text file that is to be read as part of the file list. You may precede each file name with directory path information. If you don’t provide the directory path, PowerCenter assumes the files will be located in the same directory as the file list file.

d) In Properties | Attribute | Source Filetype, click the dropdown arrow and change the default from Direct to Indirect.

Tip: When you use the file list feature in PowerCenter you have to set Properties | Attributes | Source Filetype to Indirect so that PowerCenter will understand to read this file as a list and not as a direct source.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 90: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

82 Lab 4.1 – m_STG_Customer_Contacts_xx PowerCenter 9x Level I Developer

e) Your screen should appear similar to the figure below:

Figure 7: Completed Session Task Source Properties:

The file list used in this exercise lists three test files which are found in the default location of the file list file, $PMSourceFileDir\. The figure below displays the contents of customer _list.dat.

Figure 8: Contents of the customer_list.dat file list:

f) Select SC_STG_CUSTOMERS located under the Target folder in the navigator window.

(i) Set the relational target connection property to STGxx.

g) Save your work.

h) Check the output when to ensure the workflow saved to the repository successfully.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 91: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.1 – m_STG_Customer_Contacts_xx 83

5) Under the Components Tab

a) Change the ‘On-Success Email’ Type to Non-reusable.

b) Select the Value edit button

Figure 9: On-Success Email Value Edit button:

c) Email User Name = [email protected]

d) Email Subject = Stage Customers Load Succeeded

e) Select the Email Text Value edit button

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 92: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

84 Lab 4.1 – m_STG_Customer_Contacts_xx PowerCenter 9x Level I Developer

Figure 10: Edit Success Email:

f) In the Email Text, add the following;

Stage Customers Load has completed successfully!

g) Add the following Variables:

Note: you do not have to type in the qualifiers (i.e. ‘Workflow Name =’). These qualifiers are included in the variable (%w).

Workflow Name = %w

Session name = %s

Session Start Time = %b

Session Completed Time = %c

Total Records Loaded = %l

Total Records Rejected = %r

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 93: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.1 – m_STG_Customer_Contacts_xx 85

h) Your email text should appear as shown below:

i) Click OK

j) Optional - Configure an On-Failure email.

k) Click OK.

l) Save the workflow.

6) Start the workflow.

a) Review the session properties.

b) Your information should appear as displayed in the figure below.

Figure 11: Properties for the Completed Session Run

7) If your session failed or had errors troubleshoot and correct them by reviewing the session log and make any necessary changes to your mapping or workflow.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 94: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

86 Lab 4.1 – m_STG_Customer_Contacts_xx PowerCenter 9x Level I Developer

8) Check your email

a) Login to Windows Live Mail. Programs Windows Live Mail

b) User name = [email protected].

c) Password = Studentxx

d) Your inbox should show an on-success email as seen below:

Figure 12: On-Success Email:

Step 7. Review the Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 13: Data Preview of the STG_CUSTOMERS Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 95: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.2 – m_STG_Employees_xx 87

Lab 4.2: Load the STG Employees Target

Scenario:

The staging area for Mersche Motors data warehouse has an Employee information table. The employee information is saved into three text files daily. The text files are identical. For processing simplicity, Mersche Motors will be making use of PowerCenter ability to read a list of files from a single source.

Technical Description: PowerCenter will source from a file list. The file list contains the names of three

delimited flat files from the regional sales offices. All rows with a customer number of 99999 will need to be filtered out. There are a number of columns that will needs to have the data reformatted according to the company’s business rules. The functions used to reformate the data include substring, concatenation and decodes.

Goals:

Create and use a Reusable Transformation. Practice using File Lists. Practice using Session Email functionality.

Duration:

30 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 96: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

88 Lab 4.2 – m_STG_Employees_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Flat File Source Definition

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) Log into the Repository with your Devxx login.

3) Open your folder.

4) Navigate to the Mapping Designer using the Designer Tools Toolbar.

5) Open the Source Analyzer workspace and select Clear All.

a) Import the employees_layout.txt flat file definition. This file is located in the C:\Infa_Shared\SrcFiles directory. If the file is located in a different directory, your instructor will specify.

b) Ensure that the following parameters are selected:

(i) Import field names from the first line.

(ii) Comma delimited flat file.

(iii) Text Qualifier is Double Quotes

(iv) Format of the Hire_Date field is Datetime.

(v) Format of the Date_Entered field is Datetime.

c) Confirm that your source definition appears as displayed in the following figure:

Figure 1: Flat File Definition: Employee_Layout:

d) Click Ctrl-S to save your work to the repository.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 97: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.2 – m_STG_Employees_xx 89

Step 2. Create a Relational Target Definition

1) Create a shortcut to the STG_EMPLOYEES definition from the DEV_SHARED folder in your folder. Name the shortcut SC_STG_EMPLOYEES.

2) Confirm that your target definition appears the same as displayed in the figure below:

Figure 2: Target Shortcut – SC_STG_EMPLOYEES:

Step 3. Create a Reusable Transformation

Velocity Best Practice: A Velocity Design best practice is to use as many reusable transformations as possible. This decreases development time as well as keeps mappings consistent.

1) Open the mapping m_STG_CUSTOMER_CONTACTS_xx.

2) Edit exp_FORMAT_NAME_GENDER_PHONE and check the Make Reusable box on the Transformation tab.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 98: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

90 Lab 4.2 – m_STG_Employees_xx PowerCenter 9x Level I Developer

Figure 3: Transformation Edit dialog box showing how to make a transformation reusable:

a) Click Yes when you see the popup box:

Figure 4: Question box letting you know the action is irreversible:

Tip: Converting a transformation to reusable is nonreversible. The transformation will now be saved in the Transformations subfolder within the Navigator window and will be available as a standalone object to drag into any mapping as a shortcut.

Figure 5: Transformation edit dialog box of a reusable transformation:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 99: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.2 – m_STG_Employees_xx 91

3) Review the Transformation dialog box. What differences do you see?

a) Select the Ports tab. Can you change anything here? Why are you unable to make changes?

4) Make changes to the reusable transformation.

a) Open the Transformation Developer by clicking the respective icon (highlighted) on the toolbar.

b) From the Navigator window, locate the Transformations subfolder in your respective student folder.

Figure 6: Navigator window depicting the Transformations Subfolder:

c) Drag the exp_FORMAT_NAME_GENDER_PHONE into the Transformation Developer workspace.

d) Edit the transformation name and add RE_ to the beginning of the name.

e) Click Apply

f) Select the Ports tab.

g) Remove the ‘CUST’ from the port names.

h) Click OK.

i) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 100: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

92 Lab 4.2 – m_STG_Employees_xx PowerCenter 9x Level I Developer

Step 4. Create a mapping

1) Open the Mapping Designer.

2) If a mapping is visible in the workspace, close it by selected menu option Mappings Close.

3) Create a new mapping named m_STG_EMPLOYEES_xx.

4) Add the employees_layout file source to the mapping

5) Add SC_STG_EMPLOYEES target to the mapping.

6) Your mapping will appear similar to the figure below

Figure 7: Mapping with Source and Target Definition:

Step 5. Add a Reusable Expression Transformation

1) In the Navigator window, under Transformations subfolder, click and drag RE_exp_FORMAT_NAME_GENDER_PHONE onto the Mapping Designer workspace.

2) Link the following ports from SQ_employees_layout to the SC_STG_EMPLOYEES target as shown below:

SQ_employees_layout SC_STG_EMPLOYEES

EMPLOYEE_ID EMPLOYEE_ID

ADDRESS EMPLOYEE_ADDRESS

CITY EMPLOYEE_CITY

STATE EMPLOYEE_STATE

ZIP_CODE EMPLOYEE_ZIP_CODE

COUNTRY EMPLOYEE_COUNTRY

FAX_NUMBER EMPLOYEE_FAX_NUMBER

EMAIL EMPLOYEE_EMAIL

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 101: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.2 – m_STG_Employees_xx 93

NATIVE_LANGUAGE NATIVE_LANG_DESC

SECOND_LANGUAGE SEC_LANG_DESC

THIRD_LANGUAGE TER_LANG_DESC

POSITION_TYPE POSITION_TYPE

DEALERSHIP_ID DEALERSHIP_ID

REGIONAL_MANAGER REGIONAL_MANAGER

DEALERSHIP_MANAGER DEALERSHIP_MANAGER

HIRE_DATE HIRE_DATE

DATE_ENTERED DATE_ENTERED

a) Save your work.

3) Link the following ports from SQ_employees_layout to RE_emp_FORMAT_NAME_GENDER_PHONE:

SQ_employees_layout RE_emp_FORMAT_NAME_GENDER_PHONE

FIRSTNAME in_FIRSTNAME

LASTNAME in_LASTNAME

PHONE_NUMBER in_PHONE_NUMBER

GENDER in_GENDER

AGE AGE

4) Link the following ports from RE_emp_FORMAT_NAME_GENDER_PHONE to SC_STG_EMPLOYEES.

RE_emp_FORMAT_NAME_GENDER_PHONE

SC_STG_EMPLOYEES

OUTNAME EMPLOYEE_NAME

OUT_PHONE EMPLOYEE_PHONE_NUMBER

OUT_GENDER_PORT EMPLOYEE_GENDER

OUT_AGE_GROUP AGE_GROUP

a) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 102: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

94 Lab 4.2 – m_STG_Employees_xx PowerCenter 9x Level I Developer

b) Your mapping should appear similar to the figure below:

Step 6. Create and run the workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) Create a new workflow called wf_m_STG_EMPLOYEES_ xx).

a) Edit the s_m_STG_EMPLOYEES_xx session.

b) Under the Mapping tab:

(i) Select the SQ_employee_layout located under the Sources folder in the navigator window.

(ii) Confirm the Source file directory is set to $PMSourceFileDir\.

(iii) In Properties | Attribute | Source Filename type in employees_list.txt.

c) In Properties | Attribute | Source Filetype, click the dropdown arrow and change the default from Direct to Indirect.

d) Your screen should appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 103: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.2 – m_STG_Employees_xx 95

Figure 8: Completed Session Task Source Properties:

e) Select SC_STG_EMPLOYEES located under the Target folder in the navigator window.

(i) Set the relational target connection property to STGxx.

f) Save your work.

g) Check the output when to ensure the workflow saved to the repository successfully.

3) Under the Components Tab

a) Change the ‘On-Success Email’ Type to Non-reusable.

b) Select the Value edit button

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 104: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

96 Lab 4.2 – m_STG_Employees_xx PowerCenter 9x Level I Developer

Figure 9: On-Success Email Value Edit button:

c) Email User Name = [email protected]

d) Email Subject = Stage Employees Load Succeeded

e) Select the Email Text Value edit button

Figure 10: Edit Success Email:

f) In the Email Text, add the following;

Stage Employees Load has completed successfully!

g) Add the following Variables:

Workflow Name = %w

Session name = %s

Session Start Time = %b

Session Completed Time = %c

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 105: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 4.2 – m_STG_Employees_xx 97

Total Records Loaded = %l

Total Records Rejected = %r

h) Your email text should appear as shown below:

i) Click OK

j) Optional - Configure an On-Failure email.

k) Click OK.

l) Save the workflow.

4) Start the workflow.

a) Review the session properties.

b) Your information should appear as displayed in the figure below.

Figure 11: Properties for the Completed Session Run

5) If your session failed or had errors troubleshoot and correct them by reviewing the session log and make any necessary changes to your mapping or workflow.

6) Check your email

a) If it is not already open, login to Windows Live Mail

b) User name = [email protected].

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 106: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

98 Lab 4.2 – m_STG_Employees_xx PowerCenter 9x Level I Developer

c) Password = Studentxx

d) Your inbox should show an on-success email as seen below:

Figure 12: On-Success Email:

Step 7. Review the Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 13: Data Preview of the STG_Employees Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 107: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 5.1 – m_STG_Product_xx 99

Lab 5.1: Using Homogeneous Joins to load the STG Product Target

Scenario:

There are two Oracle tables that together contain vital information about the products sold by Mersche Motors. You will need to combine the data from both tables into a single staging table that can be used as a source of data for the data warehouse.

Technical Description: PowerCenter will define a homogeneous join between the two Oracle source tables.

That source database server will perform an inner join on the tables based on a join statement automatically generated by the Source Qualifier. The join set will be loaded into the staging table.

Goals:

Import relational source definitions. View relationships between relational sources. Use a Source Qualifier to define a homogeneous join and view the statement.

Duration:

30 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 108: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

100 Lab 5.1 – m_STG_Product_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Relational Source Definition

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) Log into the Repository with your Devxx login.

3) Open your folder.

4) Navigate to the Mapping Designer using the Designer Tools Toolbar.

5) Open the Source Analyzer workspace and select Clear All.

a) Choose the menu option Sources Import from Database.

b) Connect using the ODBC Data Source SDBU, the username and password are the same.

c) Import the relational tables PRODUCT and PRODUCT_COST.

d) Save your work.

e) Your Source Analyzer workspace should appear as displayed in the figure below:

Figure 1: Source Definitions with a PK/FK Relationship Displayed in the Source Analyzer:

Tip: The arrow connecting the keys PRODUCT_ID AND PRODUCT_CODE denotes a relationship stored in the Informatica repository. By default, referential integrity (primary to foreign key) relationships defined on a database are imported when each of the tables in the relationship are imported. The arrow head is on the Primary Key (Parent) end of the relationship.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 109: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 5.1 – m_STG_Product_xx 101

Step 2. Create a Shortcut to the Target Definition

1) Open the Target Designer.

2) Right-click in the workspace and select Clear All.

3) Create a shortcut to STG_PRODUCT. Rename it SC_STG_PRODUCT.

4) Save your work.

Step 3. Create a mapping

1) Open the Mapping Designer.

2) If a mapping is visible in the workspace, close it by selected menu option Mappings Close.

3) Create a new mapping named m_STG_PRODUCT_xx.

4) Add the source definitions PRODUCT and PRODUCT_COST to the mapping.

5) Delete the SQ_PRODUCT and SQ_PRODUCT_COST source qualifier transformations automatically created by PowerCenter.

6) Select the Source Qualifier Transformation from the PowerCenter Transformation toolbar as shown highlighted below:

Figure 2: PowerCenter Transformation Toolbar with the Source Qualifier highlighted:

7) Click on the Mapping Designer workspace.

8) The Select Sources for Source Qualifier Transformation dialog box will appear as shown below:

Figure 3: Sources for the Source Qualifier Transformation

9) Confirm that both sources are selected and click OK.

10) Double-click the Source Qualifier Transformation to enter edit mode.

11) Rename the object SQ_PRODUCT_PRODUCT_COST.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 110: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

102 Lab 5.1 – m_STG_Product_xx PowerCenter 9x Level I Developer

12) Add SC_STG_PRODUCT target to the mapping.

13) Link each of the output ports in the Source Qualifier SQ_PRODUCT_PRODUCT_COST to the target SC_STG_PRODUCT ports with the same name.

a) Right-click anywhere in the workspace and use AutoLink by Name.

b) Link COST port to the PRODUCT_COST port.

14) Save your mapping and confirm that it is valid. Note that the PRODUCT_CODE port in the Source Qualifier is unlinked as intended as it is not needed at the target.

15) Your mapping will appear similar to the figure below

Figure 4: Mapping with Source and Target Definition:

Step 4. Examine the SQL Select Statement in the Source Qualifier

1) Edit the Source Qualifier

2) Open the SQL Query Editor by Clicking the arrow in the SQL Query property.

3) Click the Generate SQL button. Note that he join statement can now be

previewed, and that it is an inner join. Also note that the PRODUCT_CODE column is not in the SELECT Statement; this is because the column is not linked in the mapping and is not needed.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 111: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 5.1 – m_STG_Product_xx 103

4) Your SQL Editor should appear as displayed in the figure below:

a) Click OK twice.

b) Save your work.

Tip: It is generally not a good practice to save the generated SQL unless there is a need to override it. If you cancel out of the SQL editor, then at runtime the session will create what is called the ‘default query’. This is based on the ports and their links in the mapping. If you click OK and leave the SQL in the editor window, you’ve overridden (hardcoded) the default query. Anytime you want to link a new port out of the Source Qualifier (or delete a link), you would have to go in and regenerate the SQL.

Tip: The relationship between PRODUCT_ID and PRODUCT_CODE was used to generate the inner join statement. If you desire to join two source tables on two columns that are not keys within the database, you may establish a relationship between them by dragging the foreign key to the primary key column in the Source Analyzer. You may also modify the join statement to make it an outer join.

Step 5. Create and run the workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) If there is a workflow visible in the workspace, close it be selecting Workflows Close.

3) Create a new workflow called wf_m_STG_PRODUCT_ xx.

a) Edit the s_m_STG_PRODUCT_xx session.

b) Under the Mapping tab:

(i) Set the relational source connection property to SDBU.

(ii) Set the relational target connection property to STGxx.

c) Click OK.

d) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 112: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

104 Lab 5.1 – m_STG_Product_xx PowerCenter 9x Level I Developer

e) Check the output when to ensure the workflow saved to the repository successfully.

f) Start the workflow.

g) Review the session properties.

h) Your information should appear as displayed in the figure below.

Figure 5: Properties for the Completed Session Run

4) If your session failed or had errors troubleshoot and correct them by reviewing the session log and make any necessary changes to your mapping or workflow.

Step 6. Review the Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 6: Data Preview of the STG_PRODUCT Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 113: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 5.2 – m_STG_Transactions_xx 105

Lab 5.2: Using Heterogeneous Joins and Link Conditions to load the STG Transactions Target

Scenario:

Mersche Motors receives sales transactions data from their regional sales offices in the form of a text file. The sales transactions data needs to be loaded into the staging table. The load of the STG_Transactions table uses data from the relational table STG_Product. Therefore, our workflow must check to ensure the successful load of the STG_Product table before proceeding with the load of STG_Transactions.

Technical Description: PowerCenter will source from a flat file and relational table. A Joiner transformation

is used to create one dataflow that is then written to a relational target. The flat file is missing one field the staging target table needs; the cost of each product. This values can be read from the STG_PRODUCT table. Each row from the source file contains a value named Product. This value has an identical corresponding value in the STG_PRODUCT table PRODUCT_ID column. Use the Joiner transformation to join the flat file to the relational table (heterogeneous join) using this relationship and then write the results to the STG_TRANSACTIONS table.

Goals:

Study the Joiner Transformation and use it to join two data streams from two different source types.

Determine how to select the Master side of the join. Specify a join condition. Learn how to use link conditions in a workflow.

Duration:

30 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 114: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

106 Lab 5.2 – m_STG_Transactions_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Flat File Source Definition

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) Log into the Repository with your Devxx login.

3) Open your folder.

4) Navigate to the Mapping Designer using the Designer Tools Toolbar.

5) Open the Source Analyzer workspace and select Clear All.

6) From the menu, select Sources Import from File.

a) Import the sales_transactions.txt comma delimited flat file.

b) Ensure that the TRANSACTION_DATE is a datetime field.

7) Save the repository.

Step 2. Create a Relational Source Definiton

1) With the Source Analyzer still open;

a) Import the STG_PRODUCT table found in the STGxx schema. Use STGxx as owner name and password.

Step 3. Create a Shortcut to the Target Definition

1) Open the Target Designer.

2) Right-click in the workspace and select Clear All.

3) Create a shortcut to STG_TRANSACTIONS. Rename it SC_STG_TRANSACTIONS.

4) Save your work.

Step 4. Create a mapping

1) Open the Mapping Designer.

2) If a mapping is visible in the workspace, close it by selected menu option Mappings Close.

3) Create a new mapping named m_STG_TRANSACTIONS_xx.

4) Add the source definitions sales_transactions and STG_PRODUCT to the mapping.

5) Add SC_STG_TRANSACTIONS target to the mapping.

6) Your mapping should appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 115: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 5.2 – m_STG_Transactions_xx 107

Figure 1: Normal View of the Heterogeneous Sources, Source Qualifiers and Target:

Step 5. Create a Joiner Transformation

1) Select the Joiner transformation from the Transformation toolbar with a single left click. The figure below shows the Joiner transformation highlighted on the toolbar:

2) Create a new Joiner transformation.

3) Select all the ports from the SQ_sales_transactions source qualifier and copy/link them to the Joiner transformation.

4) Select only PRODUCT_ID AND PRODUCT_COST ports from SQ_STG_PRODUCT source qualifier and copy them to the Joiner transformation. You mapping should be similar to the figure below:

Figure 2: Normal View of Heterogeneous Sources Connected to a Joiner Transformation.

5) Edit the Joiner transformation

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 116: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

108 Lab 5.2 – m_STG_Transactions_xx PowerCenter 9x Level I Developer

a) Rename it jnr_SALES_TRANSACTION_STG_PRODUCT.

(i) Select the Ports tab

(ii) Set the Master (M) property to STG_PRODUCT ports.

Tip: Which ports should be Master? Use the source that is the smaller, in row and bytes, if the data is not sorted. If the source data is sorted, use the source with the fewest number of join column duplicates.

Figure 3: Edit View of the Ports Tab for the Joiner Transformation:

6) Uncheck the output check box for PRODUCT_ID.

7) Rename the PRODUCT_ID port to IN_PRODUCT_ID.

8) Select the Condition tab.

a) Click the Add a new condition button. The Add a new condition button is highlighted in the figure below:

Figure 4: Edit View of the Condition Tab for the Joiner Transformation Without a Condition:

9) The Master drop down box will default to IN_PRODUCT_ID.

Master Property

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 117: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 5.2 – m_STG_Transactions_xx 109

10) Select the Detail drop down box and set it to PRODUCT. Your condition should be the same as displayed in the figure below:

Figure 5: Edit View of the Condition Tab for the Joiner Transformation with Completed Condition:

Tip: The Joiner transformation can support multiple port conditions to create a join. If you need multiple port conditions, simply click the Add a new condition button to add the other ports that make up the port condition.

11) Click OK.

12) Save the repository.

Step 6. Link the Target Table

1) Link the following ports from the Joiner transformation to the corresponding columns in the target object.

jnr_SALES_TRANSACTION_STG_PRODUCT SC_STG_TRANSACTIONS

CUST_NO CUST_ID

PRODUCT PRODUCT_ID

DEALERSHIP DEALERSHIP_ID

PAYMENT_DESC PAYMENT_DESC

PROMO_ID PROMO_ID

DATE_ID DATE_ID

TRANSACTION_DATE TRANSACTION_DATE

TRANSACTION_ID TRANSACTION_ID

EMPLOYEE_ID EMPLOYEE_ID

TIME_KEY TIME_KEY

SELLING_PRICE SELLING_PRICE

PRODUCT_COST UNIT_COST

DELIVERY_CHARGES DELIVERY_CHARGES

QUANTITY SALES_QTY

DISCOUNT DISCOUNT

HOLDBACK HOLDBACK

REBATE REBATE

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 118: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

110 Lab 5.2 – m_STG_Transactions_xx PowerCenter 9x Level I Developer

a) Your mapping should appear similar to the figure displayed below:

Figure 6: Normal View of Completed Heterogeneous Join Mapping:

2) Save your work.

3) Verify your mapping is valid in the Output window. If the mapping is not valid, correct the invalidations that are displayed in the message.

Step 7. Create and run the workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) If there is a workflow visible in the workspace, close it be selecting Workflows Close.

3) Open wf_m_STG_PRODUCT_xx.

a) Edit the workflow. Rename it wf_m_STG_PRODUCT_TRANSACTIONS_xx.

b) Click OK.

4) Edit s_m_STG_PRODUCT.

a) In the Mapping Tab

b) Select the truncate target table option for SC_STG_PRODUCT.

5) Click on the session task on the Workflow Task toolbar. Click on the Workflow Designer workspace.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 119: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 5.2 – m_STG_Transactions_xx 111

6) Select m_STG_TRANSACTIONS_xx mapping to associate with the session.

a) Double-click to edit the s_m_STG_TRANSACTIONS_xx session.

b) Under the Mapping tab:

(i) Confirm that the Source File directory is set to $PMSourceFileDir\.

(ii) Confirm that that Source File name is set to sales_transactions.txt.

(iii) Set the relational source connection for STG_PRODUCT to STGxx

(iv) Set the relational target connection property to STGxx.

c) Click OK.

7) Draw a link between the s_m_STG_PRODUCT_xx session and the s_m_STG_TRANSACTIONS_xx session.

8) Your workflow should appear similar to the figure below:

Figure 7: Workflow with two linked sessions:

9) Double-click the link between s_m_STG_PRODUCT_xx and s_m_STG_TRANSACTIONS_xx sessions.

10) The s_m_STG_PRODUCT_xx Expression Editor will appear.

11) Type the following expression into the editor:

$s_m_STG_PRODUCT_xx.Status = SUCCEEDED

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 120: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

112 Lab 5.2 – m_STG_Transactions_xx PowerCenter 9x Level I Developer

12) The Expression Editor should appear similar to the figure displayed below:

Figure 8: Expression Editor for the Session:

a) Click OK.

b) Your workflow should appear similar to the figure displayed below:

Figure 9: wf_m_STG_PRODUCT_TRANSACTIONS_xx:

c) Save your work.

d) Check the output when to ensure the workflow saved to the repository successfully.

e) Start the workflow.

f) Review the session properties.

g) Your information should appear as displayed in the figure below.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 121: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 5.2 – m_STG_Transactions_xx 113

Figure 10: Properties for the Completed Session Run

13) If your session failed or had errors troubleshoot and correct them by reviewing the session log and make any necessary changes to your mapping or workflow.

Step 8. Review the Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 122: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

114 Lab 5.2 – m_STG_Transactions_xx PowerCenter 9x Level I Developer

Figure 11: Data Preview of the STG_TRANSACTIONS Target Table:

Figure 12: Data Preview of the STG_PRODUCT Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 123: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 6 Features and Techniques 115

Lab 6: Features and Techniques

Goals:

In this lab you will learn and practice some features and techniques that will increase your efficiency as a PowerCenter Developer.

Duration:

30 minutes

Instructions

WARNING: In this lab, do not save your work. While it is normally best practice to save your work frequently while working in PowerCenter, in this case you will be making changes to a Mapping that is already the way you want it. So don’t save your work!

Step 1. Arrange All and Arrange All Iconic

In a complex Mapping, it can be hard to see how the parts relate. How can you make this better?

1) Begin with the Mapping from Lab 4-1 (m_STG_CUSTOMER_CONTACTS_xx) open in the PowerCenter Developer application.

2) Right-click anywhere in the workspace and select Arrange All.

3) Observe the results.

Arrange All is a tool for arranging the transformations in a Mapping neatly.

4) Right-click again and select Arrange All Iconic.

Arrange All Iconic enables you to quickly see the relationships between the objects in a Mapping.

Step 2. Autolink

1) “Arrange All” on the Mapping.

2) Drag the cursor across the links between the Source definition and the Source Qualifier to select them.

3) Hit the Delete key on your keyboard.

4) Right-click and select Autolink by Name.

5) Position the cursor over the Source, then click and drag to the Source Qualifier.

6) Click the SQ again to return to the normal (arrow) cursor.

Autolinking provides a quick way to connect the output ports in one transformation to the input ports in another transformation.

Autolink by Name searches for ports with identical names and connects them

Autolink by Position connects the first output port to the first input port, the second output port to the second input port, etc.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 124: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

116 Lab 6 Features and Techniques PowerCenter 9x Level I Developer

7) Delete the links again and Autolink the two by Position.

Step 3. Select Link Path

Suppose another developer has created a large, complex Mapping that is not working quite right: some data is winding up in the wrong fields. And you have been asked to debug it. How can you figure out where the data is coming from? Answer: By tracing the link paths.

a) On the Target definition, right-click the CUST_ZIP_CODE field and select Select Link Path Backward.

(i) The link to the CUST_ZIP_CODE field is now red.

b) Expand the Filter transformation so you can see the related field there.

(i) Note that the links leading both into and out of it are red.

c) You can, by expanding the appropriate transformations, trace the lineage of the CUST_ZIP_CODE field all the way back to the ZIP field in the Source definition.

Selecting the link path enables you to easily trace the lineage of any field forward and backward through a Mapping.

Step 4. Propagating Port Properties

You have to change the datatype of a field in the Source. Do you really have to manually adjust every port along its link path? No.

1) Edit the Source Qualifier and select the Ports tab.

2) Change the name of the CUSTOMER_NO port to CUST_NO and its precision from 5 to 10.

3) Click OK.

4) Right-click CUST_NO in the Source Qualifier and select Propagate Attributes.

5) In the “Propagate Port Attributes” dialogue:

a) Under "Attributes to Propagate" select Name and Precision, with a direction of Both.

b) Click Preview.

c) Note the green and red arrows. What will be changed?

d) Click Propagate, then Close.

e) Was a change made in the Filter? What was it?

f) Was a change made in the Target definition? Why or why not?

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 125: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 6 Features and Techniques 117

Step 5. Moving Ports

Sometimes just rearranging the ports on a transformation will make the Mapping easier to read.

1) Edit the Filter transformation and select the Ports tab.

2) Click the AGE port and use the “up arrow” ( ) button to move it to the top of the list of ports.

3) Single-click and hold the number next to the ZIP field. Note the square that appears in the cursor.

4) Drag ZIP right below AGE.

5) Click Cancel to discard the changes.

Step 6. Another Method of Creating Transformations

Plus, it bypasses the default names PowerCenter gives a transformation.

1) From the menu, select TransformationCreate

2) Select Aggregator from the dropdown box.

3) Name the Aggregator agg_Demo_Create.

4) Click Create.

a) The new transformation appears in the workspace.

5) By the same method, create a Filter named fil_Demo_Create.

6) Click Done.

While we’re at it, how do you remove an unwanted transformation?

7) The Filter you just created is already selected. Hold down the Shift key and click the Aggregator you created to select it, too.

8) Hit the Delete key on your keyboard.

a) Note that the Designer dialogue tells you which transformations will be deleted.

b) Click Yes.

Step 7. Reverting to Saved

Sometimes you make a mistake that you can’t easily undo and need to go back to where you were before. If you haven’t saved, you can do it.

1) In the Repository Navigator, right-click your folder and select Disconnect.

2) When asked whether to save the changes to your folder, click No.

3) Reopen your folder.

4) If necessary, reopen the Mapping.

5) Note that it is back to the way it was before Step 1.

6) Arrange All for the next step.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 126: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

118 Lab 6 Features and Techniques PowerCenter 9x Level I Developer

Step 8. Scaling

You may not be able to see the whole Mapping in your workspace. But you can.

1) Maximize PowerCenter Developer.

2) How many transformations can you see?

3) In the Standard toolbar at the top of the window, click the Zoom dropbox

( ) and select 60.

4) Can you see more transformations?

5) Click the Scale to fit icon ( ) beside the Zoom dropbox.

6) You can now see all your transformations at once.

Step 9. Switching Transformations While Editing

When editing several transformations, you don’t have to close the Edit Transformations dialogue and reopen it repeatedly…

1) Double-click the Source Qualifier transformation to edit it.

2) Select the Ports tab.

3) In the Select transformation: dropbox, select the Filter transformation.

4) What happens?

Step 10. Copy Objects Within and Between Mappings

You may find that you want to duplicate a set of transformations within a Mapping or a Mapplet, preserving the dataflow between them. This technique may prove useful if you know that you will need to use the logic contained in the transformations in other Mappings or Mapplets.

1) Arrange All Iconic.

2) Use your left mouse button to draw a rectangle that encloses the Filter and Expression transformations. This will select these objects.

3) Press Ctrl+C on your keyboard, immediately followed by Ctrl+V.

4) Note that both transformations have been copied onto the mapping, including the dataflow between them. They have been renamed with a “1” on the end of their names.

5) Open another Mapping.

6) Press Ctrl+V again.

7) The transformations are added to the open Mapping.

8) Disconnect from your folder but do not save the changes (revert to the previously saved version).

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 127: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 6 Features and Techniques 119

Step 11. View Object Dependencies

By viewing object dependencies in the Designer, a user can learn which objects may be affected by making changes to Source or Target definitions, Mappings, Mapplets, or transformations. Direct and indirect dependencies are shown.

1) In the Repository Navigator, select the flat-file Source definition CUSTOMER_LAYOUT.

2) Right-click and select Dependencies.

3) Click OK to show all dependencies.

4) You will see the View Dependencies window, which will show every Mapping, Session, and Workflow that uses or depends upon the CUSTOMER_LAYOUT Source, as well as those that it uses or depends on.

5) It also shows the Customers flat file definition in Dev_Shared that CUSTOMER_LAYOUT depends on.

Note: The Save to File button on the View Dependencies window saves the dependency information as a HTML file (.htm) for later viewing.

6) Experiment by viewing the dependencies of other objects.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 128: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

120 Lab 6 Features and Techniques PowerCenter 9x Level I Developer

Answers

4.5.e. Was there a change made in the Filter? What was it? Yes, the name and precision of the Customer Number port changed to match the changes in the Source Qualifier.

4.5.f. Was there a change made in the Target definition? Why or why not? No, the Source and Target definitions cannot be changed or edited in the Mapping Designer workspace. They can only in the Source Analyzer and Target Designer workspaces.

9.4. What happens? You now see and can work with the ports of the Filter transformation.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 129: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 7 – The Debugger 121

Lab 7: Using the Debug Wizard

Scenario:

The Mapping m_STG_DATES_DEBUG contains at least one error that results in bad data loaded into the target table. You must find and correct this error so that the data warehouse project can proceed successfully.

Goals:

Use the Debug toolbar Use the Debug Wizard

Duration:

35 minutes

Instructions

Step 1. Copy and Inspect the Debug Mapping

1) In the Designer application, make sure you are connected and open to your assigned Devxx folder.

2) Expand the folder Dev_Shared.

a) Locate and select the Mapping m_STG_DATES_DEBUG.

b) From the menu, select EditCopy.

3) Return to your Devxx folder.

a) Select your Mapping subfolder.

b) From the menu, select EditPaste.

c) In the “Copy Confirmation” dialogue, click Yes.

4) Save the Repository.

Tip: Note that the Mapping validates properly. The validation process ensures that the Mapping is technically valid, but it cannot test for errors in business logic.

5) Open the Mapping in the Mapping Designer workspace.

a) Inspect the Mapping to get an overall idea of what kind of processing is being done.

b) Read the expressions in the Expression transformation.

6) You have been told only that there is an “error” in the data being written to the target, without any further clarification as to the nature of the error.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 130: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

122 Lab 7 – The Debugger PowerCenter 9x Level I Developer

Tip: Many Mapping errors can be found by carefully inspecting the Mapping, without using the Debug Wizard. If the error cannot be quickly located in this manner, the Debug Wizard can help you by showing the actual data passing through the transformation ports. However, to use the Debug Wizard effectively, you need to understand the logic of the Mapping.

Step 2. Open the Debug Toolbar and Start the Debug Wizard

1) On the Toolbar, right-click to bring up a list of available toolbars. Select the “Debugger” toolbar.

Figure 1: Open the Debugger Toolbar

Figure 2: Debugger Toolbar

Tip: If the Debugger Toolbar is not visible, it is possible that another toolbar has shifted it off the screen. Rearrange the other toolbars until you can see it.

2) EITHER click the Start Debugger button ( ) OR press F9 to start the Debug Wizard.

3) The first page of the Debug Wizard is informational. Please read it and press Next.

Tip: The Debug Wizard requires a valid Mapping and Session to run – it cannot help you determine why a Mapping is invalid. The Output window of the Designer will show you the reason(s) why a Mapping is invalid.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 131: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 7 – The Debugger 123

4) The Wizard should now look like this:

Figure 3: Debug Session Creation Dialogue

a) From the dropdown box, select the Integration Service INT_EDW_DEV.

b) In the Session box, select the Create a debug session radio button.

c) Click Next.

5) The next page of the Wizard allows you to set connection properties, similar to creating Sessions in the Workflow Manager application.

a) Set the Target Connection Value to STGxx

(i) You will discard the debugger data in a later step, so this value will be ignored.

b) Select the Properties tab at the bottom.

(i) Add the “.txt” extension to the Source filename property value.

(ii) Set the Target load type property to Normal

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 132: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

124 Lab 7 – The Debugger PowerCenter 9x Level I Developer

c) Your Wizard should now look like this:

Figure 4: Debug Session Connections Dialogue

d) Click Next three times.

These panels enable you to set which transformations in the Mapping you wish to monitor in this debugging session, and set Session configuration information, such as a parameter file or which connections the variables $Source and $Target correspond to.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 133: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 7 – The Debugger 125

e) Ensure that Discard target data is checked.

Figure 5: Discard Target Data

f) Click Finish.

6) PowerCenter creates and initializes a Debug Session.

a) The Debug Wizard automatically opens windows to view target and transformation data. No data will be read until you are ready to view it.

Resize the Debugger Target Data Display and Debugger Data Display windows as needed.

A good guideline is to have them look something like this:

Figure 6: Debugger Windows

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 134: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

126 Lab 7 – The Debugger PowerCenter 9x Level I Developer

Step 3. Locate the Error

1) Your screen should now look like this:

Figure 7: Designer During a Debug Session

2) In the Target Instance dropdown box, select STG_DATES_VIEW.

3) In the Instance dropdown box, select SQ_dates.

Note: The term “instance” here refers to an object in the Mapping. Thus, each transformation is an “instance.”

4) Click the “Next Instance” button ( ) on the Debugger toolbar.

a) Data displays in the Instance window.

Figure 8: Data in the Instance Window

5) Toggle the dropdown to the Expression transformation.

a) Note that there is no data available as yet – the Instance window, with the Next Instance button, shows data as it moves from transformation to transformation through the Mapping.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 135: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 7 – The Debugger 127

6) Click the Step to Instance button ( )

a) Note that one more row has been read, and the first row has been “pushed” to the Expression transformation and the Target table.

7) Click the Step to Instance button several more times (at least 13), watching how the data flows from the Instance window to the Target Instance window. Compare the results between the Target instance and Instance windows.

a) What is the nature of the error in the data being written to the table?

b) Double-click the Expression transformation to open it.

Tip: Note that the transformation properties are grayed-out. While you can view and copy expressions, you cannot edit the Mapping or its components while the Debugger session is running.

c) What is causing the error?

Step 4. Fix the Error

Tip: Nonetheless, you CAN try new variations on expression while the Debugger is running.

1) Click the Ports tab.

a) Enter the Expression Editor for one of the output ports – preferably the one that seems likely to be causing the problem.

b) Select the text of the expression (even though it is grayed-out) and copy it to the Windows clipboard by typing Ctrl+C.

c) Click Cancel twice.

d) Right-click the Expression transformation and select Evaluate Expression.

e) Paste the expression text you chose into the Expression Editor and press Evaluate.

(i) The Debugger will immediately evaluate the expression with the current data in the ports.

(ii) You can make as many changes to the Expression here as you need.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 136: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

128 Lab 7 – The Debugger PowerCenter 9x Level I Developer

(iii) Once you have a modified expression that you want to keep, copy it to the Windows clipboard.

2) Close the expression evaluator

3) Stop the Debugger by pressing the Stop Debugger button ( ) on the Debugger toolbar

a) Click Yes to “Shutdown the debugger.”

4) Edit the Expression transformation and put your modified Expression in place by pasting it into the Expression Editor.

5) Save your work.

6) Restart the Debugger and test to ensure that your fix worked.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 137: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 7 – The Debugger 129

Answers

3.7.a What is the nature of the error in the data being written to the table? The month and date seem to be reversed. That is, the data comes in as January 1, January 2, etc., but is being written as January 1, February 1, etc.

3.7.c. What is causing the error? The Expression Editor is using a format of DD/MM/YYYY but the incoming data has a format of MM/DD/YYYY.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 138: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

130 Lab 7 – The Debugger PowerCenter 9x Level I Developer

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 139: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.1 – m_ODS_Employees_xx 131

Lab 8.1: Using a Lookup to load the ODS Employee Target

Scenario:

Information about Mersche Motors employees is loaded to a relational target table on a regular basis by an external process. Your tech lead has decided to recreate that external process using PowerCenter. Sensitive employee data, such as salary has only now become available for use in the warehouse. It is important that we go back and update the entire table with this salary information using this new mapping. This information has been made accessible in text file format. This file and the EMPLOYEE relational Oracle table can be joined together using the EMPLOYEE_ID column from each source. A workflow should be created which will check for the presence of the flat file before executing the load. If the flat file does not show up in time, an email alert should be sent.

Technical Description: PowerCenter will use a flat file as a lookup for employee salary data and use that

information to update the target ODS_EMPLOYEE table. The session property, Treat Source Rows As, will be used to update the entire table. Use an Event Wait, Timer and Email task to ensure flat file is on the server in time and if not, send email.

Goals:

Utilize lookup to a flat file. Determine how to use Treat Source Rows As session property. Use Event Wait, Timer, Control and Email Tasks in a Workflow

Duration:

45 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 140: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

132 Lab 8.1 – m_ODS_Employees_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Shortcut to a Relational Source Definition

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) Log into the Repository with your Devxx login.

3) Open your folder.

4) Navigate to the Mapping Designer using the Designer Tools Toolbar.

5) Open the Source Analyzer workspace and select Clear All.

6) Create a shortcut to the relational source, EMPLOYEES. This table will be found under the SDBU node of the Sources subfolder in DEV_SHARED.

7) Rename it SC_EMPLOYEES.

8) Your source should appear similar to the figure below:

Figure 1: SC_EMPLOYEES relational source shortcut:

9) Save your work.

Step 2. Create a Shortcut to a Relational Target Definition

1) Open the Target Designer.

2) Right-click in the workspace and select Clear All.

3) Create a shortcut to ODS_EMPLOYEES. Rename it SC_ODS_EMPLOYEES.

4) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 141: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.1 – m_ODS_Employees_xx 133

Step 3. Create a mapping

1) Open the Mapping Designer.

2) If a mapping is visible in the workspace, close it by selected menu option Mappings Close.

3) Create a new mapping named m_ODS_EMPLOYEES_xx.

4) Add the source definition SC_EMPLOYEES to the mapping.

5) Add SC_ODS_EMPLOYEES target to the mapping.

6) Save your work

Step 4. Create a Lookup transformation

1) Select the Lookup transformation from the Transformation toolbar with a single left click. The figure below shows the Joiner transformation highlighted on the toolbar:

Figure 2: Transformation Toolbar – Lookup Transformation:

2) Move your mouse pointer onto the Mapping Designer workspace and single click your left mouse button. This will create a new Lookup Transformation.

3) The Select Lookup Table for Lookup Transformation dialog box will appear.

a) Select Import Flat File for the location of the Lookup table.

Figure 3: Lookup Transformation table location dialog box:

4) Locate the c:\infa_shared\SrcFiles directory and select the file salaries.txt. If the file is located in a different location, the instructor will specify.

5) The Flat File wizard will appear. Confirm that the Delimited Option button is selected.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 142: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

134 Lab 8.1 – m_ODS_Employees_xx PowerCenter 9x Level I Developer

6) Select the Import field names from the first line check box. Your wizard should appear similar to the figure below:

Figure 4: Dialog box 1 of 3 Flat File Import Wizard:

7) Click Next.

8) Confirm that only the Comma check box under Delimiters is selected.

9) Select the No Quotes option button under Text Qualifier.

10) Click Next.

11) Confirm that the field names are displayed under Column Information. These were imported from the first line.

12) Click Finish.

13) Confirm that your Lookup transformation appears as displayed in the figure below:

Figure 5: Normal View of the newly created Lookup Transformation:

14) Drag the EMPLOYEE_ID from the SQ_EMPLOYEES source qualifier to the new Lookup Transformation.

15) Edit the Lookup Transformation.

16) Rename it lkp_SALARIES.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 143: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.1 – m_ODS_Employees_xx 135

Velocity Best Practice: Velocity naming conventions specify to name Lookup transformations lkp_LOOKUP_TABLE_NAME.

17) Click on the Port tab.

a) Rename EMPLOYEE_ID1 TO IN_EMPLOYEE_ID.

b) Clear the output port for IN_EMPLOYEE_ID.

c) Click Apply.

(i) You should receive a popup message indicating the Lookup condition is empty. Click the Yes button to continue.

(ii) Select the Condition tab.

(iii) Select the Add a new Condition button.

(iv) Your condition should look similar to the figure below:

Figure 6: Lookup Transformation Condition Tab:

d) Click OK.

18) Save your work.

19) Autolink by name all ports from the SQ_EMPLOYEE source qualifier to the SC_ODS_EMPLOYEES target.

20) Link the SALARY port from lkp_SALARIES to the SC_ODS_EMPLOYEES

target.

21) Your mapping should appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 144: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

136 Lab 8.1 – m_ODS_Employees_xx PowerCenter 9x Level I Developer

Figure 7: Normal View of the m_ODS_EMPLOYEES_xx mapping:

Step 5. Create and run the workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) If there is a workflow visible in the workspace, close it be selecting Workflows Close.

3) Create a new workflow called wf_m_ODS_EMPLOYEES_ xx).

a) Edit the s_m_ODS_EMPLOYEES_xx session.

b) Under the Mapping tab:

(i) Set the relational source connection for SQ_EMPLOYEES to SDBU

(ii) Set the relational target connection property to ODSxx.

(iii) Click the lkp_SALARIES lookup under the Transformations subfolder.

(iv) Ensure the Lookup Source File directory is set to $PMSourceFileDir\.

(v) Set the Lookup Source Filename to salaries.txt.

(vi) Your Lookup properties should appear as shown below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 145: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.1 – m_ODS_Employees_xx 137

Figure 8: Mapping Tab – lkp_SALARIES Properties:

c) Click Properties tab of the Session.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 146: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

138 Lab 8.1 – m_ODS_Employees_xx PowerCenter 9x Level I Developer

d) Change the Treat Source Rows as property to Update.

e) Your screen should appear as displayed below:

Figure 9: Properties tab of the s_m_ODS_EMPLOYEES_xx session:

Note: PowerCenter’s default behavior is to mark each row for Insert. However, that behavior can be altered. When you change the Treat Source Rows as property to Update, Integration Service marks all rows to update the target. You can further define the update operation by adding an update strategy transformation to the mapping. With an update strategy, you can test each row against a condition, and then mark each row accordingly; update, insert or delete.

f) Click OK.

g) Save your work.

h) Check the output when to ensure the workflow saved to the repository successfully.

4) Start the workflow.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 147: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.1 – m_ODS_Employees_xx 139

a) Review the session properties.

b) Your information should appear as displayed in the figure below.

Figure 10: Properties for the Completed Session Run

5) If your session failed or had errors troubleshoot and correct them by reviewing the session log and make any necessary changes to your mapping or workflow.

Step 6. Review the Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 11: Data Preview of the ODS_EMPLOYEES Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 148: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

140 Lab 8.1 – m_ODS_Employees_xx PowerCenter 9x Level I Developer

Step 7. Add Workflow Tasks to check for arrival of Flat File.

It is always a good idea to make sure your sessions are executing as they should before you add other logic to a workflow. It makes troubleshooting much easier. Now that we have determined that our session task is executing as expected, we will add additional workflow tasks to this workflow to ensure that it executes as expected.

1) Still in the Workflow Manager, select the Event Wait task from the Workflow Tasks toolbar. The Event Wait task is shown highlighted below:

a) Drop the Event Wait task on the Workflow Designer workspace.

b) Delete the link between the Start Task and the Session Task by clicking on the link to make it red, then select your Delete key.

c) Draw a link between the Start Task and the Event Wait task.

2) Edit the Event Wait task.

a) On the General tab, select Fail Parent if this task fails, as shown below:

b) Select the Events tab

c) Ensure the Predefined: This is a file-watch event radio button is selected.

d) Enter c:\infa_shared\SrcFiles\Watch_xx.txt as the name of the watch file as

shown below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 149: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.1 – m_ODS_Employees_xx 141

e) Rename the Event Wait task evnt_SALARIES.

f) Click OK.

3) Link evnt_SALARIES to the session task s_m_ODS_EMPLOYEES_xx.

a) Your workflow should appear similar to the figure below:

4) Select the Timer task from the Workflow Tasks toolbar. The Timer task is shown highlighted below:

5) Drop the Timer Task on the workspace.

6) Edit the Timer Task.

a) On the General tab, rename the Timer task to tmr_ODS_EMPLOYEES_xx.

b) Select Fail parent if this task fails.

c) Select the Timer tab.

d) Select the Relative Time radio button.

e) Add a time in which you would like the timer to start. Two minutes from the

time you start the workflow would be best.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 150: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

142 Lab 8.1 – m_ODS_Employees_xx PowerCenter 9x Level I Developer

f) Select the from the start time of this task radio button.

g) Your screen should look similar to the figure below:

7) Click OK.

8) Link the Start Task to tmr_ODS_EMPLOYEES.

9) Right-click and select Arrange Horizontal.

10) Your workflow should appear as shown in the figure below:

Figure 12: wf_m_ODS_EMPLOYEES_xx

11) Select the Email task from the Workflow Tasks toolbar. The Email task is shown highlighted below:

12) Drop the Email Task on the workspace.

13) Edit the Email Task.

a) On the General tab, rename the Email task to eml_No_Salaries.

b) Select Fail parent if this task fails.

c) Select the Properties tab.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 151: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.1 – m_ODS_Employees_xx 143

d) Email User Name = [email protected]

e) Email Subject = No Salaries Flat File

f) Email Text = The Salaries Flat File did not show up in time to execute the ODS_Employees load.

Figure 13: Eml_No_Salaries:

g) Click OK.

14) Link the Timer Task tmr_ODS_EMPLOYEES to eml_No_Salaries Email Task.

15) Double-click the link between tmr_ODS_EMPLOYEES and eml_No_Salaries Email Task and enter $evnt_SALARIES.Status != SUCCEEDED as the link condition.

a) Click OK.

16) Right-Click on the workspace and select Arrange Horizontal.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 152: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

144 Lab 8.1 – m_ODS_Employees_xx PowerCenter 9x Level I Developer

17) Your workflow should look similar to the figure below:

18) Select the Control task from the Workflow Tasks toolbar. The Control task is shown highlighted below:

19) Drop the Control Task on the workspace.

20) Edit the Control Task.

a) On the General tab, rename the Control task to cntl_Stop_Workflow.

b) Select Fail parent if this task fails.

c) Under ‘Treat the Input Links as:’ section, select the OR radio button.

d) Select the Properties tab.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 153: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.1 – m_ODS_Employees_xx 145

e) Set the Value drop down to Stop Parent.

f) Click OK.

21) Link the session s_m_ODS_EMPLOYEES_xx to the Control Task

22) Link the eml_No_Salaries email task to the Control Task

23) Your workflow should appear similar to the figure below:

24) Save your work.

Step 8. Restart the Workflow

1) Navigate to the Workflow Monitor

2) Select Filters Tasks from the menu.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 154: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

146 Lab 8.1 – m_ODS_Employees_xx PowerCenter 9x Level I Developer

3) Ensure that the Email task is selected.

4) Right-click on the Workflow Designer workspace and select Start Workflow.

5) Observe the workflow. Note that the event wait and timer tasks are running

6) Create the watch_xx.txt file and place it on the c:\infa_shared\SrcFiles directory.

This file may need to be created on a different mapped drive. Please ask your instructor where the watch file should be placed.

7) The Workflow Run should appear similar to the figure below:

8) Feel free to experiment with the workflow.

a) What happens if the watch_xx.txt file never shows up?

b) Do you get an email?

c) What happens if the control task General Property of ‘Treat Input Links as:’ is changed to And?

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 155: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.2 – m_ODS_Dates_xx 147

Lab 8.2: Using a Sequence Generator to load ODS Dates Target

Scenario:

The Mersche Motors data warehouse has a date dimension table that needs to be loaded. The date dimension needs to be loaded before any of the other dimension tables due to foreign key constraints. The Dates Stage table is loaded with one record for each date covered in the Operational Data Store (ODS). Each date has been described with the date attributes used in the ODS, such as the month name, quarter name, whether the date is a weekday or a weekend and so forth. In this lab, you will use the Dates Staging table to build a Dates ODS table for the warehouse. The ODS_Dates table will be used as a persistent lookup cache for other dimension loads. A primary key for the ODS_Dates table will be assigned using the Sequence Generator.

Technical Description: PowerCenter will extract the dates from a shared relational table and load them into a

shared relational target. All columns in the source table have matching columns in the target table. A primary key for the target table will be assigned using the Sequence Generator.

Goals:

Create Sources and Targets based on shortcuts. Create a Sequence Generator transformation. Create unique integer primary key values using the NEXTVAL port.

Duration:

20 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 156: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

148 Lab 8.2 – m_ODS_Dates_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Shortcut to a Relational Source Definition

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) Log into the Repository with your Devxx login.

3) Open your folder.

4) Navigate to the Mapping Designer using the Designer Tools Toolbar.

5) Open the Source Analyzer workspace and select Clear All.

6) Create a shortcut to the relational source, STG_DATES. This table will be found under the STG node of the Sources subfolder in DEV_SHARED.

7) Rename it SC_STG_DATES.

8) Your source should appear similar to the figure below:

Figure 1: SC_STG_DATES relational source shortcut:

9) Save your work.

Step 2. Create a Shortcut to a Relational Target Definition

1) Open the Target Designer.

2) Right-click in the workspace and select Clear All.

3) Create a shortcut to ODS_DATES. Rename it SC_ODS_DATES.

4) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 157: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.2 – m_ODS_Dates_xx 149

Step 3. Create a mapping

1) Open the Mapping Designer.

2) If a mapping is visible in the workspace, close it by selected menu option Mappings Close.

3) Create a new mapping named m_ODS_DATES_xx.

4) Add the source definition SC_STG_DATES to the mapping.

5) Add SC_ODS_DATES target to the mapping.

6) Save your work

Step 4. Create a Sequence Generator transformation

1) Select the Sequence Generator transformation from the Transformation toolbar with a single left click. The figure below shows the Sequence Generator transformation highlighted on the toolbar:

Figure 2: Transformation Toolbar – Sequence Generator Transformation:

2) Move your mouse pointer onto the Mapping Designer workspace and single click your left mouse button. This will create a new Sequence Generator Transformation.

3) Confirm that your new Sequence Generator transformation appears similar to the figure below:

Figure 3: Normal View of the newly created Sequence Generator Transformation:

4) Edit the Sequence Generator Transformation.

5) Rename it seq_ODS_DATES_Date_Key.

6) Select the Properties tab and observe the properties available in the Sequence Generator.

a) Check the Reset Transformation attribute value.

7) Click the OK button to return to the Normal view of the Sequence Generator.

8) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 158: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

150 Lab 8.2 – m_ODS_Dates_xx PowerCenter 9x Level I Developer

Step 5. Link the Target Table

1) Link all the ports from the Source Qualifier transformation to the corresponding columns in the target object utilizing the Autolink by Name feature.

Figure 4: Normal View of the connected ports to the target:

2) Save your work.

3) Verify the mapping is valid I the Output window. If the mapping is not valid, correct the invalidations that are displayed in the message.

Step 6. Create and run the workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) If there is a workflow visible in the workspace, close it be selecting Workflows Close.

3) Create a new workflow called wf_m_ODS_DATES_ xx).

a) Edit the s_m_ODS_DATES_xx session.

b) Under the Mapping tab:

(i) Set the relational source connection for SQ_SC_STG_DATES to STGxx.

(ii) Set the relational target connection for SC_ODS_DATES target to ODSxx.

(iii) Set the Target Load Type to Normal.

(iv) Check the property to Truncate the target table option in the target properties.

(v) Save your work.

(vi) Check the output when to ensure the workflow saved to the repository successfully.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 159: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.2 – m_ODS_Dates_xx 151

c) Start the workflow.

d) Review the session properties.

e) Your information should appear as displayed in the figure below.

Figure 5: Properties for the Completed Session Run

4) If your session failed or had errors troubleshoot and correct them by reviewing the session log and make any necessary changes to your mapping or workflow.

Step 7. Review the Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 6: Data Preview of the ODS_DATES Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 160: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

152 Lab 8.2 – m_ODS_Dates_xx PowerCenter 9x Level I Developer

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 161: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.3 – m_ODS_Promotions_xx 153

Lab 8.3: Creating a Lookup Cache and loading the ODS Promotions Target

Scenario:

Mersche Motors runs a number of promotions that begin and end on certain dates. The promotions are stored in the ODS Promotions table. This table also stores the start and expiring dates as date keys that reference the ODS_DATES table. However, that data just became available due to the creation of the previous mapping. We will use the newly created date keys to update the ODS Promotions table.

Technical Description: The ODS_PROMOTIONS table requires start and expiration date keys. These exist

in the ODS_DATES table that was populated in the previous lab. To obtain these date keys, which were created by the sequence generator, it will be necessary to perform a Lookup to the ODS_DATES table in the ODS database. The ODS_DATES table changes infrequently so it will be loaded into cache in a persistent state. The lookup cache can be used often by other Mappings that load ODS tables.

Goals:

Understand how to configure and use a persistent Lookup cache.

Duration:

25 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 162: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

154 Lab 8.3 – m_ODS_Promotions_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Shortcut to a Relational Source Definition

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) Log into the Repository with your Devxx login.

3) Open your folder.

4) Navigate to the Mapping Designer using the Designer Tools Toolbar.

5) Open the Source Analyzer workspace and select Clear All.

6) Create a shortcut to the relational source, PROMOTIONS. This table will be found under the SDBU node of the Sources subfolder in DEV_SHARED.

7) Rename it SC_PROMOTIONS.

8) Your source should appear similar to the figure below:

Figure 1: SC_PROMOTIONS relational source shortcut:

9) Save your work.

Step 2. Create a Shortcut to a Relational Target Definition

1) Open the Target Designer.

2) Right-click in the workspace and select Clear All.

3) Create a shortcut to ODS_PROMOTIONS. Rename it SC_ODS_PROMOTIONS.

4) Save your work.

Step 3. Create a mapping

1) Open the Mapping Designer.

2) If a mapping is visible in the workspace, close it by selected menu option Mappings Close.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 163: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.3 – m_ODS_Promotions_xx 155

3) Create a new mapping named m_ODS_PROMOTIONS_xx.

4) Add the source definition SQ_SC_ PROMOTIONS to the mapping.

5) Add SC_ODS_PROMOTIONS target to the mapping.

6) Use Autolink by Name to link SQ_SC_ PROMOTIONS and SC_ODS_PROMOTIONS.

7) Save your work.

8) Your mapping should appear similar to the figure below.

Step 4. Create Lookups for the Start and Expire Date Keys

1) Examine the Figure 2.

Figure 2: m_ODS_PROMOTIONS_xx Mapping:

2) In Figure 2, compare START_DATE and EXPIRE_DATE in SQ_SC_PROMOTIONS to START_DK and EXPIRY_DK in the SC_ODS_PROMOTIONS target table. Notice that these two ports are not connected and the datatypes are different. The target requires key values (number), not dates.

In what table do these Date Key values exist? ________________________.

3) Examine Figure 3.

Figure 3: m_ODS_DATES from the previous lab that populated the ODS_DATES table:

The ODS Dates table was populated by the previous lab, the DATE_KEY was generated by the seq_ODS_DATES_Date_key Sequence Generator transformation and DATE_VALUE has a datetype of datetime.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 164: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

156 Lab 8.3 – m_ODS_Promotions_xx PowerCenter 9x Level I Developer

4) To acquire the value for the START_DK in the ODS_PROMOTIONS target table, you need to perform a Lookup on the ODS_DATES table.

You will base the Lookup Condition on the _________________ port from SQ_SC_PROMOTIONS Source Qualifier and the _________________ column in the ODS_DATES Lookup table.

5) Similarly, to acquire the value for the EXPIRE_DK in the SC_ODS_PROMOTIONS target, you will need a second Lookup on the ODS_DATES as well.

You will base the Lookup Condition on the __________________ port from SQ_SC_PROMOTIONS Source Qualifier and the ________________ column in the ODS_DATES Lookup table.

6) Add a Lookup Transformation to the mapping based on the SC_ODS_DATES (shortcut to the ODS_DATES) target table.

Figure 4: Select Lookup Table:

7) Rename the Lookup Transformation to lkp_START_DATE_KEY.

8) Click OK.

9) Click YES to verify the “Look up Condition is empty”. You will define this shortly.

10) Now drag and drop the START_DATE port from SQ_SC_PROMOTIONS Source Qualifier to an empty port in the lkp_START_DATE_KEY transformation.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 165: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.3 – m_ODS_Promotions_xx 157

11) Make START_DATE input only.

12) Rename START_DATE to IN_ START_DATE.

13) Define the Lookup Condition to look like the figure below:

Figure 5: Lookup Condition:

14) On the Properties tab, verify the following values:

a) Lookup Table Name = ODS_DATES(default).

b) Lookup Caching Enabled = Checked (default).

c) Lookup Cache Persistent = Checked (needs to be set).

d) Cache File Name Prefix = LKPSTUxx (where xx is your student number).

15) Link the DATE_KEY port from the lkp_START_DATE_KEY transformation to the START_DK port in the SC_ODS_PROMOTIONS target.

16) Save your work.

Note: Notice that this transformation has many ports. We could have unchecked Output column on all ports except for the ones that we need but since this lookup transformation will be persistent it would have limited its functionality for all other mappings that might leverage that data.

The lkp_START_DATE_KEY transformation will not retrieve values for the EXPIRY_DK because the lookup conditions will be different.

17) Create a second Lookup Transformation called lkp_EXPIRE_DATE_KEY by copying lkp_START_DATE_KEY.

18) Make the changes necessary to the Lookup to ensure that the EXPIRE_DATE finds the proper DATE_KEY.

a) Rename it lkp_EXPIRE_DATE_KEY

b) Rename IN_START_DATE to IN_EXPIRE_DATE

c) Verify the Lookup Condition is correct.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 166: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

158 Lab 8.3 – m_ODS_Promotions_xx PowerCenter 9x Level I Developer

19) Link the EXPIRE_DATE port from the SQ_SC_PROMOTIONS Source Qualifier to the IN_EXPIRE_DATE port in the lkp_EXPIRE_DATE_KEY transformation.

20) Link DATE_KEY port from the lkp_EXPIRE_DATE_KEY transformation to the EXPIRY_DK port in the SC_ODS_PROMOTIONS target.

21) Save your work.

Figure 6: m_ODS_PROMOTIONS_xx completed mapping:

Step 5. Create and run the workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) If there is a workflow visible in the workspace, close it be selecting Workflows Close.

3) Create a new workflow called wf_m_ODS_PROMOTIONS_ xx).

a) Edit the s_m_ODS_PROMOTIONS_xx session.

b) Under the Mapping tab:

(i) Set the Target Load Type to Normal.

(ii) Click on Connections in the Navigator.

(iii) Set the relational source connection for SQ_SC_PROMOTIONS to SDBU.

(iv) Set the relational target connection for SC_ODS_PROMOTIONS target to ODSxx.

(v) Set the $Target connection value to ODSXX.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 167: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 8.3 – m_ODS_Promotions_xx 159

(vi) The Mapping tab should appear similar to the figure below:

(i) Save your work.

(ii) Check the output when to ensure the workflow saved to the repository successfully.

c) Start the workflow.

d) Review the session properties.

e) Your information should appear as displayed in the figure below.

Figure 7: Properties for the Completed Session Run

4) If your session failed or had errors troubleshoot and correct them by reviewing the session log and make any necessary changes to your mapping or workflow.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 168: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

160 Lab 8.3 – m_ODS_Promotions_xx PowerCenter 9x Level I Developer

Step 6. Review the Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 8: Data Preview of the ODS_PROMOTIONS Target Table:

By setting the Lookup Cache Persistent property on the Lookup Transformation two files were created on the PowerCenter Server, see figure below. Note that these files are on the PowerCenter Server machine, not your local computer and that the names will correspond to the name that you entered in the Cache File Name Prefix Lookup property. To view these files, you will need to map to the file system on the PowerCenter Server machine. Verify that the files have a timestamp similar to when you ran the above workflow.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 169: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 9 – m_DIM_Employees_xx 161

Lab 9: Updating Targets Using PowerCenter

Scenario:

The Mersche Motors data warehouse employee table is updated on a daily basis. Source rows from the transactional area need to be tested to determine if the row already exists in the dimension table. Rows need to be tagged for update or insert accordingly. Any rows containing bad data will need to be written to an error file.

Technical Description: Rows from the TRANS_EMPLOYEES table need to be loaded into the

DIM_EMPLOYEES table. Before loading the rows, EMPLOYEE_ID needs to be tested for NULL values. Invalid rows need to be written to an error file. Valid rows need to be tested to determine if they exist already in the DIM_EMPLOYEES target table and tagged for either INSERT or UPDATE accordingly. Finally, any rows sent to the DIM_EMPLOYEE table need to get valid date keys from DIM_DATES.

Goals:

Employ Update Strategy Transformation to tag rows for INSERT or UPDATE. Utilize the Router Transformation to conditionally route rows to different target

instances. Use Default values option for NULL data replacement. Overriding Target writer option.

Duration:

60 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 170: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

162 Lab 9 – m_DIM_Employees_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Copy mapping from a shared area

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) Log into the Repository with your Devxx login.

3) Open your folder.

4) Navigate to the Mapping Designer using the Designer Tools Toolbar.

5) If a mapping is visible in the workspace, close it by selected menu option Mappings Close.

6) Copy m_DIM_EMPLOYEES_xx partial mapping from the DEV_SHARED

folder to your student folder.

7) Click ‘Yes’ on the Dependencies Dialog box.

8) Rename the new mapping m_DIM_EMPLOYEES_xx using your student number.

9) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 171: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 9 – m_DIM_Employees_xx 163

Step 2. Edit the Expression Transformation

1) Open the mapping m_DIM_EMPLOYEES_xx.

2) Your mapping should appear similar to the figure below.

Figure 1: m_DIM_EMPLOYEES_xx Mapping:

3) Edit the exp_NULL_EMPLOYEE_ID expression transformation and add a Default value of 99999 to the EMPLOYEE_ID port.

a) Click the button to validate the default entry and click OK.

4) Edit the lkp_DIM_EMPLOYEES_EMPLOYEE_ID Lookup Transformation.

Note the Lookup Condition: EMPLOYEE_ID = in_EMPLOYEE_ID

This condition is looking for a value where the Employee ID from the DIM_EMPLOYEE Target table is equal to the Employee ID coming from the Trans_Employees Source.

a) Rename the EMPLOYEE_ID to DIM_EMPLOYEE_ID

(i) Note: DIM_EMPLOYEE_ID represents the ID that would come from the lookup on the Target, DIM_EMPLOYEE.

(a) If that value comes back as a null, then the Employee_ID coming from the source has no matching record for that Employee at the Target. Meaning it is a new record and by definition, an Insert Record.

(b) If that value comes back as not null then, there is a record at the Target matching the Employee_ID coming in from the Source, so the record is an update.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 172: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

164 Lab 9 – m_DIM_Employees_xx PowerCenter 9x Level I Developer

b) Rename the in_EMPLOYEE_ID to Source_EMPLOYEE_ID

(i) Note: Source_Employee_ID represents the ID that would come from the Source, Trans_Employees.

(a) The value could come into the lookup as ‘99999’, which would mean it was null at the source, as determined by our Default Value on the port in the Expression Transformation. A null coming from the source has been determined to be an erroneous record.

(b) Source_Employee_ID could contain a not null value, which would mean it is either an insert or update for the DIM_EmployeeTarget. Logic written in the Groups Tab of the Router Transformation will determine which it is.

c) Renaming the Target Employee_ID makes the mapping more readable, however, it will cause PowerCenter to submit an erroneous SQL statement to the database similar to the following:

d) Therefore, we should override the SQL in the lookup (lkp_ DIM_EMPLOYEES_EMPLOYEE_ID) and change the SQL so it refers to the correct field name.

5) Click the Properties tab of the Lookup Transformation.

6) Click the SQL Override dropdown arrow.

7) Click the Generate SQL button.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 173: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 9 – m_DIM_Employees_xx 165

8) Change the SQL Statement

a) Edit the SQL written by PowerCenter from:

SELECT DIM_EMPLOYEES.DIM_EMPLOYEE_ID as DIM_EMPLOYEE_ID FROM DIM_EMPLOYEES

To

SELECT DIM_EMPLOYEES. EMPLOYEE_ID as DIM_EMPLOYEE_ID FROM DIM_EMPLOYEES

9) The SQL should appear similar to the figure below:

10) Click OK.

11) Save your work.

Step 3. Create a Router Transformation

The Router Transformation will be used to determine which rows will be inserted, updated or sent to the error file. This will be done by checking the value of the EMPLOYEE_ID port.

1) Add a Router Transformation to the mapping:

2) Drag both ports from lkp_DIM_EMPLOYEES_EMPLOYEE_ID into the Router.

3) Drag all ports except EMPLOYEE_ID from exp_NULL_EMPLOYEE_ID to the Router.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 174: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

166 Lab 9 – m_DIM_Employees_xx PowerCenter 9x Level I Developer

4) Your Router should appear similar to the figure below:

Figure 2: Router Transformation linked to Lookup and Expression:

5) Edit the Router Transformation

a) Rename the Router rtr_DIM_EMPLOYEES.

b) In the Groups tab add 3 new groups using the Add new group icon.

(i) Name the first group INSERTS:

(ii) Add the Group filter Condition:

ISNULL(DIM_EMPLOYEE_ID) AND Source_EMPLOYEE_ID != 99999

(iii) Name the second group UPDATES:

(iv) Add the Group filter Condition:

NOT ISNULL(DIM_EMPLOYEE_ID) AND Source_EMPLOYEE_ID != 99999

(v) Name the third group ERRORS:

(vi) Add the Group filter Condition:

Source_EMPLOYEE_ID = 99999

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 175: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 9 – m_DIM_Employees_xx 167

Your Router should appear similar to the figure below:

Figure 3: Router Groups:

Step 4. Create an Update Strategy for INSERTS

1) Add an Update Strategy Transformation named upd_INSERTS to the mapping.

2) In the Router, scroll down to the INSERTS group and drag all ports, except DIM_EMPLOYEE_ID1 and HIRE_DATE1, to upd_INSERTS update strategy.

3) Edit the upd_INSERTS Update Strategy

a) Rename the Source_EMPLOYEE_ID1 port to EMPLOYEE_ID1.

b) In the Properties tab

(i) Select the Update Strategy Expression Value box. Delete the 0 and enter DD_INSERT. See the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 176: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

168 Lab 9 – m_DIM_Employees_xx PowerCenter 9x Level I Developer

Figure 4: Update Strategy set to INSERT:

(ii) Click OK.

4) Your mapping should look similar to the figure below:

Figure 5: Router Insert Group linked to upd_INSERTS:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 177: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 9 – m_DIM_Employees_xx 169

Step 5. Create a Lookup to DIM_DATES

1) Create a Lookup Transformation named lkp_DIM_DATES_INSERTS that references the DIM_DATES target table. The definition of the target table was copied to your folder during the copy mapping operation:

2) Pass DATE_ENTERED1 from upd_INSERTS to lkp_DIM_DATES_INSERTS.

3) Edit the lkp_DIM_DATES_INSERTS Lookup transformation

a) Make all the ports Lookup only except

(i) DATE_KEY – should be Output and Lookup.

b) Rename the DATE_ENTERED1 port to IN_DATE_ENTERED.

(i) In_Date_Entered – Should be Input only.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 178: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

170 Lab 9 – m_DIM_Employees_xx PowerCenter 9x Level I Developer

c) Create the condition DATE_VALUE = IN_DATE_ENTERED. Ensure that you use DATE_VALUE, not DATE_KEY.

d) In the Properties tab set the following values:

(i) Lookup Cache persistent = Checked (needs to be set)

(ii) Cache File Name Prefix = lkp_DIM_DATES_xx

Step 6. Link upd_INSERTS and lkp_DIM_DATES_INSERTS to the Target

1) Link the DATE_KEY port from lkp_DIM_DATES_INSERTS to the INSERT_DK column in the DIM_EMPLOYEES_INSERTS target.

2) Right-click anywhere in the workspace and select Autolink…

a) Select upd_INSERTS from the From Transformation drop down box

b) Select DIM_EMPLOYEES_INSERTS from the To Transformation box.

c) Select the More>> button and enter a ‘1’ for the From Transformation Suffix.

d) You screen should appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 179: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 9 – m_DIM_Employees_xx 171

Figure 6: Autolink Screen for upd_INSERTS to DIM_EMPLOYEES_INSERTS:

e) Click OK.

f) Your mapping should look similar to the figure below:

Figure 7: Router, upd_INSERTS, lkp_DIM_DATES_INSERTS linked to Target:

g) Save your work.

Step 7. Create an Update Strategy for UPDATES

1) Create an Update Strategy transformation named upd_UPDATES.

2) In the Router, scroll down to the UPDATES Router group and drag all ports, except Source_EMPLOYEE_ID3 and HIRE_DATE3 to the upd_UPDATES update strategy transformation.

3) Edit the upd_UPDATES transformation

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 180: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

172 Lab 9 – m_DIM_Employees_xx PowerCenter 9x Level I Developer

a) Rename the DIM_EMPLOYEE_ID3 port to EMPLOYEE_ID3

b) In the Properties tab, select the Update Strategy Expression value box. Delete the 0 and enter DD_UPDATE.

Step 8. Create Second Lookup to DIM_DATES

1) Right-click on the existing lkp_DIM_DATES_INSERTS lookup transformation and select Copy.

2) Move the cursor to the workspace, right-click and select Paste.

3) Link DATE_ENTERED3 from upd_UPDATES to IN_DATE_ENTERED in the new Lookup transformation.

4) Edit the new Lookup transformation

a) Rename the lookup to lkp_DIM_DATES_UPDATES.

b) Ensure the Lookup condition is: DATE_VALUE = IN_DATE_ENTERED.

5) The Update portion of your mapping should appear similar to the figure below:

Step 9. Link upd_UPDATES and lkp_DIM_DATES_UPDATES to the Target

1) From lkp_DIM_DATES_UPDATES, llink DATE_KEY to UPDATE_DK in DIM_EMPLOYEES_UPDATES target.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 181: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 9 – m_DIM_Employees_xx 173

2) Right-click anywhere in the workspace and select Autolink…

a) Select upd_UPDATES from the From Transformation drop down box

b) Select DIM_EMPLOYEES_UPDATES target from the To Transformation box.

c) Select the More>> button and enter a ‘3’ for the From Transformation

Suffix.

d) Your screen should look similar to the figure below:

Figure 8: Autolink Screen for UPDATES:

3) Click OK.

4) Ensure that DIM_Employee_ID3 is linked to EMPLOYEE_ID of the Target Transformation.

5) Your mapping should look similar to the figure below:

6) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 182: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

174 Lab 9 – m_DIM_Employees_xx PowerCenter 9x Level I Developer

Step 10. Link ERRORS Router Group to the Target

1) Using Autolink…

a) Select the ERRORS group of rtr_DIM_EMPLOYEES from the From Transformation drop down box

b) Select DIM_EMPLOYEES_ERR from the To Transformation box.

c) Select the More>> button and enter a ‘4’ for From Transformation Suffix.

d) The Autolink dialog should appear similar to the figure below:

e) Click OK.

2) Ensure that Source_Employee_ID4 is linked to EMPLOYEE_ID of the Target Transformation.

3) Save your work and ensure the mapping is valid.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 183: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 9 – m_DIM_Employees_xx 175

4) Arrange all Iconic. Your mapping should appear similar to the figure below:

Step 11. Create and run the workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) If there is a workflow visible in the workspace, close it be selecting Workflows Close.

3) Create a new workflow called wf_m_DIM_EMPLOYEES_ xx).

a) Edit the s_m_ DIM_EMPLOYEES_xx session.

b) Under the Mapping tab:

(i) Set the relational source connection for SQ_TRANS_EMPLOYEES to SDBU.

(ii) Set the relational target connection for DIM_EMPLOYEES_INSERTS target to EDWxx.

(iii) Set the Target Load Type to Normal.

(iv) Set the relational target connection for DIM_EMPLOYEES_UPDATES target to EDWxx.

(v) Set the Target Load Type to Normal.

(vi) Set $Target Connection Value to EDWxx.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 184: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

176 Lab 9 – m_DIM_Employees_xx PowerCenter 9x Level I Developer

Step 12. Add a Source Filter Override

1) Click on the SQ_TRANS_EMPLOYEES source

2) Add the above value to the Source Filter.

Tip: It is sometimes easier to add a quick Source filter in the Session than to go back and modify the mapping, save it, refresh the session, save it, then run the

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 185: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 9 – m_DIM_Employees_xx 177

workflow. SQL overrides will override any entries in the mapping until the override is deleted. Make sure if using ‘shortcuts’ the prefix to the table is deleted before saving the filter.

Step 13. Rename the Output Filename

1) Select the DIM_EMPLOYEES_ERR target and change the target writer from Relational to File Writer.

Tip: To create a flat file as a target instead of the original table, simply change the Writers type from Relational to File. A fixed width flat file based on the format of the target definition will be created automatically. The properties of this file can also be altered by the user.

a) Save your work.

b) Check the output when to ensure the workflow saved to the repository successfully.

c) Start the workflow.

d) Review the session properties.

e) Your information should appear as displayed in the figure below.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 186: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

178 Lab 9 – m_DIM_Employees_xx PowerCenter 9x Level I Developer

Figure 9: Properties for the Completed Session Run

2) If your session failed or had errors troubleshoot and correct them by reviewing the session log and make any necessary changes to your mapping or workflow.

Step 14. Review the Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 10: Data Preview of the DIM_EMPLOYEES Target Table:

Scroll all the way to the right and confirm that the INSERT_DK column was updated and not the UPDATE_DK column.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 187: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 9 – m_DIM_Employees_xx 179

Also, you may want to review the three rows that were written to the error file. See the instructor for the location of the files. If the server is running on UNIX, you may need special permission from your administrator to see the files.

Figure 11: Data Results for the Error Flat File

Step 15. Prepare, Execute and Monitor the Second Run

1) Edit the s_m_DIM_EMPLOYEES_xx session task.

a) In the Mapping tab,

(i) Click SQ_TRANS_EMPLOYEES in the Navigator window.

(ii) Scroll down the Properties section and edit the Source Filter to reflect day two loading: 01/03/2003.

2) Save and Execute the workflow.

3) Review the session properties and transformation statistics.

4) They should appear the same as displayed in the figure below:

Figure 12: Properties tab results for Second Run:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 188: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

180 Lab 9 – m_DIM_Employees_xx PowerCenter 9x Level I Developer

Review the DIM_EMPLOYEES target data from the Designer. Scroll to the far right of the data screen and notice that there are now entries for UPDATE_DK and new entries at the bottom of the list for INSERT_DK.

Figure 13: Data Preview showing updates to the Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 189: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 10.1 – m_Fact_Sales_xx 181

Lab 10.1: Using PowerCenter to load the Fact Sales Target

Scenario:

Mersche Motors dealerships sometimes give aggressive discounts that are outside the authorized range. These type of discounts are a small percentage compared to the number of rows being processed but the information needs to be processed accordingly. Also, even though the source dimension table contains 7 days of data this production execution will load the entire dimension table into the SALES_FACT table in a single workflow.

Technical Description: The information needed resides in two separate dimension tables. To compound this,

the relationship between the two tables does not exist on the database. Referential integrity will have to be created within PowerCenter. Special formulas are needed to process the discounts out of range. To make this more efficient, the user of mapping parameters and variables will be used.

Goals:

Employ the use of an Unconnected Lookup to conditionally check rows as they pass through the mapping.

Utilize the Aggregator Transformation to group and sum values. Use Mapping Parameters to improve the flexibility of the mapping.

Duration:

35 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 190: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

182 Lab 10.1 – m_Fact_Sales_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Copy mapping from a shared area

1) If you are not already logged into PowerCenter, please double-click the

PowerCenter Designer icon ( ) on your desktop to start it.

2) Log into the Repository with your Devxx login.

3) Open your folder.

4) Navigate to the Mapping Designer using the Designer Tools Toolbar.

5) If a mapping is visible in the workspace, close it by selected menu option Mappings Close.

6) Copy m_FACT_SALES_xx partial mapping from the DEV_SHARED folder to your student folder.

7) Rename the new mapping m_ FACT_SALES_xx using your student number.

8) Right-click and select Arrange All Iconic

9) Your mapping should appear similar to the figure below:

Figure 1: m_FACT_SALES_xx Mapping:

10) Open the Source Analyzer workspace and select Clear All.

a) Drag the DIM_TRANSACTIONS and DIM_PAYMENT relational sources from the EDW node onto the workspace.

b) The PAYMENT_DESC column from DIM_TRANSACTIONS and the PAYMENT_TYPE_DESC column from the DIM_PAYMENT table are logically related so we can build a join on them. They both contain payment type description information.

Note: Creating the PK-FK relationship within the Source Analyzer does not create the relationship on the actual physical database. The relationship is created on the Source Definitions within the PowerCenter Repository only.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 191: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 10.1 – m_Fact_Sales_xx 183

Your source definitions should appear the same as displayed below:

Figure 2: Source Analyzer view of the DIM_PAYMENT and DIM_TRANSACTIONS tables:

Step 2. Edit the lkp_DIM_DATES Lookup Transformation

1) Edit the lkp_DIM_DATES Lookup

2) In the Properties tab

a) Change the Cache File Name to lkp_DIM_DATES_xx

b) Click OK.

Step 3. Create a Mapping Parameter

1) Navigate back to the Mapping Designer.

2) Add a mapping parameter by clicking Mappings Parameters and Variables.

3) On the Declare Parameters and Variables dialog, click the Add a new variable to this table icon as shown in the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 192: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

184 Lab 10.1 – m_Fact_Sales_xx PowerCenter 9x Level I Developer

4) Create a new parameter:

a) Parameter Name = $$MAX_DISCOUNT

b) Type = Parameter

c) Datatype = Decimal

d) Precision = 15, 2

e) For the initial value, enter 17.25

5) Click OK.

6) Save your work.

Step 4. Create an Unconnected Lookup

1) Create a Lookup transformation using the DIM_PROMOTIONS relational target table. You will use EDW as ODBC Data Source as shown below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 193: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 10.1 – m_Fact_Sales_xx 185

2) Edit the lookup tranformation

a) Name the lookup lkp_DIM_PROMOTIONS.

b) Under the Ports tab

(i) Click on PROMO_ID, then click the Copy icon , and then the Paste

icon .

(ii) Name the new port IN_PROMO_ID and make it an input only port.

(iii) Make DISCOUNT the return port.

(iv) Uncheck the Output ports for all other ports except PROMO_ID and DISCOUNT.

(v) The lookup should look the same as the figure below:

Figure 3: Lookup Ports tab showing input, output and return ports checked/unchecked:

3) Create the lookup condition comparing PROMO_ID and IN_PROMO_ID.

4) Click OK and save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 194: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

186 Lab 10.1 – m_Fact_Sales_xx PowerCenter 9x Level I Developer

Step 5. Add Unconnected Lookup Test to Expression

1) Edit the exp_DISCOUNT_TEST Expression transformation.

2) If the IN_DISCOUNT port has a value greater that the value passed in via a mapping parameter, then we need to get an acceptable value from the DIM_PROMOTIONS table. The variable port v_DISCOUNT will be used to hold the return value. Edit the v_DISCOUNT variable port and add the expression:

IIF(IN_DISCOUNT > $$MAX_DISCOUNT, :LKP.LKP_DIM_PROMOTIONS(PROMO_ID), IN_DISCOUNT)

3) The discount is held as a whole number. We need to change this to a percentage and apply it against the selling price to derive the dollar value of the discount. Edit the output port OUT_DISCOUNT and add the expression:

V_DISCOUNT / 100 * SELLING_PRICE

Step 6. Create an Aggregator Transformation

1) Create an Aggregator transformation named agg_FACT_SALES.

2) Drag the PRODUCT_KEY PORT from lkp_DIM_PRODUCT to agg_FACT_SALES.

3) Drag the DATE_KEY port from lkp_DIM_DATES to agg_FACT_SALES.

4) Drag the following ports from the Expression transformation to the Aggregator:

a) PAYMENT_ID

b) CUST_ID

c) DEALERSHIP_ID

d) PROMO_ID

e) SELLING_PRICE

f) UNIT_COST

g) SALES_QTY

h) HOLDBACK

i) REBATE

j) OUT_DISCOUNT

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 195: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 10.1 – m_Fact_Sales_xx 187

5) Your mapping should look similar to the figure below:

6) Open the Aggregator and re-order the key ports in the following order:

a) CUST_ID

b) PRODUCT_KEY

c) DEALERSHIP_ID

d) PAYMENT_ID

e) PROMO_ID

f) DATE_KEY

7) Group By these ports.

8) Uncheck the output ports for SELLING_PRICE, UNIT_COST and SALES_QTY.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 196: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

188 Lab 10.1 – m_Fact_Sales_xx PowerCenter 9x Level I Developer

9) Rename:

a) SELLING_PRICE to IN_SELLING_PRICE

b) UNIT_COST to IN_UNIT_COST

c) SALES_QTY to IN_SALES_QTY

d) OUT_DISCOUNT to DISCOUNT

10) Add the following new ports:

a) Create a new output port after the DISCOUNT port.

Port Name OUT_UNITS_SOLD

Datatype Decimal

Precision 3

Expression SUM(IN_SALES_QTY)

b) Create a new output port after the OUT_UNITS_SOLD

Port Name OUT_REVENUE

Datatype Decimal

Precision 15,2

Expression SUM((IN_SELLING_PRICE * IN_SALES_QTY) - DISCOUNT - HOLDBACK - REBATE)

c) Create a new output port after the OUT_REVENUE port.

Port Name OUT_COST

Datatype Decimal

Precision 15,2

Expression SUM(IN_UNIT_COST)

The Aggregator ports should be the same as displayed in the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 197: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 10.1 – m_Fact_Sales_xx 189

Figure 4: Finished Aggregator:

11) Use Autolink by name to link the ports from the agg_FACT_SALES transformation to the FACT_SALES target table. You will need to use the prefix of OUT_ to link all of the ports.

12) The results should appear the same as the figure below:

Figure 5: Aggregator to Target Links:

13) Save your work

14) Iconize the mapping.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 198: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

190 Lab 10.1 – m_Fact_Sales_xx PowerCenter 9x Level I Developer

Figure 6: Iconic View of the completed mapping

Step 7. Create and run the workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) If there is a workflow visible in the workspace, close it be selecting Workflows Close.

3) Create a new workflow called wf_m_FACT_SALES_ xx).

a) Edit the s_m_FACT_SALES_xx session.

b) Under the Mapping tab:

(i) Set the relational source connection for SQ_DIM_TRANSACTIONS_PAYMENT to EDWxx.

(ii) Set the relational target connection for FACT_SALES target to EDWxx.

(iii) Set the Target Load Type to Normal.

(iv) Set $Target Connection Value to EDWxx.

(v) Set your Connections to the entries below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 199: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 10.1 – m_Fact_Sales_xx 191

4) Save your work.

5) Start the workflow.

6) Review the session properties

a) Your information should appear as displayed in the figure below.

Figure 7: Properties for the Completed Session Run

7) If your session failed or had errors troubleshoot and correct them by reviewing the session log and make any necessary changes to your mapping or workflow.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 200: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

192 Lab 10.1 – m_Fact_Sales_xx PowerCenter 9x Level I Developer

Step 8. Review the Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 8: Data Preview of the FACT_SALES Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 201: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 10.2 – m_Fact_Sales_xx 193

Lab 10.2: Create a Mapplet

Scenario:

The Team Lead has noticed that there are other situations where we can reuse some of the transformations developed in the FACT_SALES mapping.

Technical Description: To take advantage of previously created objects, we will create a mapplet from

existing objects used in a previous mapping. This mapplet can then be used in other mappings.

Goals:

Use a mapplet in a mapping

Duration:

10 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 202: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

194 Lab 10.2 – m_Fact_Sales_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create the Mapplet

1) In the Mapping Designer, re-open the m_FACT_SALES_xx mapping.

2) Highlight the following five transformations by holding down the Ctrl key and pressing the left mouse button:

a) lkp_DIM_PROMOTIONS

b) lkp_DIM_PRODUCT

c) lkp_DIM_DATES

d) exp_DISCOUNT_TEST

e) agg_FACT_SALES

3) Select Edit Copy or the Ctrl+C.

4) Open the Mapplet Designer. Create a mapplet named mplt_AGG_SALES.

a) Select Edit Paste or the Ctrl+V.

b) Right-Click in the workspace and Arrange All.

c) Select the Scale to Fit icon.

5) Your mapplet definition should look the same as the figure below:

Figure 1: Mapplet Designer View of mplt_AGG_SALES:

6) Add a Mapplet Input transformation

7) Add a Mapplet Output Transformation

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 203: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 10.2 – m_Fact_Sales_xx 195

8) From the exp_DISCOUNT_TEST transformation, drag all Input ports to the Mapplet Input transformation

9) From the Aggregator agg_FACT_SALES, drag all Output ports to the Output transformation.

10) Select the Scale to Fit icon.

11) The mapplet should look similar to the figure below:

Figure 2: Mapplet Designer view of mplt_AGG_SALES with Input and Output transformations:

12) Save your work.

13) Notice that the mapplet is invalid. Scroll through the messages in the output window. They point to the expression exp_DISCOUNT_TEST as having an invalid symbol reference. The reference to the parameter $$MAX_DISCOUNT is invalid as it does not exist within the mapplet parameter definition.

Note: Mapping parameters and variables that are created in a mapping are not available for use in the mapplet that is called from the mapping.

Step 2. Create a new Mapplet Parameter

1) Select Mapplets Parameters and Variables.

a) Parameter Name = $$MAX_DISCOUNT

b) Type = Parameter

c) Datatype = Decimal

d) Precision = 15,2

e) Initial Value = 17.25

2) Save your work.

Step 3. Add the Mapplet to the Mapping

1) Make a copy of the m_FACT_SALES_xx mapping and open it in the Mapping Designer.

2) Delete the 5 transformations that you previously copied to the mapplet.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 204: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

196 Lab 10.2 – m_Fact_Sales_xx PowerCenter 9x Level I Developer

3) Use Autolink by Name to linkt he ports from the SQ_DIM_TRANSACTIONS_PAYMENT to the mplt_AGG_SALES input.

4) Manually link the DISCOUNT port to the IN_DISCOUNT port.

5) Use Autolink by name to link the Output portion of the mapplet to the target. You will need to specify ‘OUT_ ‘for the prefix and ‘1’ for the suffix.

6) Save your work

7) You mapping should look the same as the figure below:

Figure 3: Normal View of the m_FACT_SALES_xx after mapplet has been added:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 205: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 11 – wf_Fact_Product_Agg_Weekly_xx 197

Lab 11: Using Workflow Variables and Tasks to load a Weekly Aggregate Target

Scenario:

The Mersche Motors data warehouse contains a number of aggregate tables. The management wants to be able to report total sales for a product on a weekly basis. A weekly product sales aggregate tables needs to be loaded for this purpose.

Technical Description: The source for the weekly Product aggregate table will be the daily Product aggregate

table. The mapping to load this table is located in the DEV_SHARED folder. A workflow needs to be created that will run the weekly aggregate load session after the daily aggregate load session has run 7 times. This can be accomplished using an assignment tasks, a decision task, link conditions and session tasks. A load date equal to the beginning day of the week will be used to provide the date key for the weekly aggregate table. The mapping to accomplish this has already been created and will need to be copied from the DEV_SHARED folder. It contains a mapping variable that will be incremented by 1 at the end of the session/mapping run.

Goals:

Assign Workflow Variables Increment Workflow Variables using the Assignment Task Branch the logic of a workflow using a Decision Task Use Link Conditions

Duration:

35 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 206: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

198 Lab 11 – wf_Fact_Product_Agg_Weekly_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Copy the mappings

1) In the Mapping Designer, copy:

a) m_FACT_PRODUCT_AGG_DAILY_xx mapping

b) m_FACT_PRODUCT_AGG_WEEKLY_xx mapping

from the DEV_SHARED folder.

2) Select Yes for any Target Dependencies.

3) Select Skip or Reuse to resolve any conflicts.

4) Rename the mappings to include your student number.

5) Save your work.

Step 2. Copy the Existing Workflow

1) In the Workflow Manager, copy the wf_FACT_PRODUCT_AGG_WEEKLY_xx workflow from the DEV_SHARED folder and rename it to include your student number.

2) Resolve the conflict by selecting the m_FACT_PRODUCT_AGG_DAILY_xx mapping.

3) Drag the new workflow into the Workflow Designer.

4) Edit the s_m_FACT_PRODUCT_AGG_DAILY_xx session and make the following changes:

a) Rename it to include your assigned student number.

b) In the Properties tab

(i) Change the $Target connection value to reflect your assigned student number connection EDWxx.

(ii) Change the Session Log File Name to include your student number.

(iii) Change the source connection value to STGxx.

(iv) Change the target connections to reflect your assigned student connection, EDWxx.

(v) Change the Target Load Type to Normal.

5) Select the menu option Workflows Edit.

a) Rename it to include your student number.

b) In the Properties tab change the Workflow log file name to include your student number.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 207: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 11 – wf_Fact_Product_Agg_Weekly_xx 199

c) In the Variables tab create a new workflow variable

(i) Variable Name = $$WORKFLOW_RUNS

(ii) Datatype = integer

(iii) Persistent = checked

(iv) Default Value = 0

Figure 1: Workflow Variable Declaration:

Step 3. Create the Assignment Task

1) Add an Assignment Task to the Workflow.

2) Link the s_m_FACT_PRODUCT_AGG_DAILY_xx session to the Assignment task.

3) Double-click the link.

4) Add a link condition to ensure that the Assignment Task only executes if the s_m_FACT_PRODUCT_AGG_DAILY_xx session task was successful. See the figure below for details:

Figure 2: Link Condition testing if a previous session was successful:

5) Edit the Assignment Task

a) Rename it asgn_WORKFLOW_RUNS.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 208: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

200 Lab 11 – wf_Fact_Product_Agg_Weekly_xx PowerCenter 9x Level I Developer

b) In the Expression tab, create an expression that increments the User Defined Variable named $$WORKFLOW_RUNS by 1. See the figure below for details.

Figure 3: Assignment Task Expression Declaration:

c) Save your work.

Step 4. Add a Decision Task

1) Add a Decision Task to the workflow

2) Link the asgn_WORKFLOW_RUNS Assignment task to the Decision task.

3) Double-Click the link.

4) Add a link condition to ensure that the decision task only executes if the asgn_WORKFLOW_RUNS assignment task was successful.

5) Edit the Decision Task

a) Rename it to dcn_RUN_WEEKLY.

b) In the Properties tab

(i) Create a Decision Name expression using the modulus function that check to see if this is the seventh run of the workflow. This can be done by dividing the workflow variable by seven and check to see if the remainder is 0. See the figure below for details.

Figure 4: Decision Task Expression:

Tip: The decision task will evaluate the expression and return a value of TRUE or FALSE. This can be checked in a link condition to determine the direction taken.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 209: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 11 – wf_Fact_Product_Agg_Weekly_xx 201

Step 5. Create the Session Task

1) Create a session task named s_m_FACT_PRODUCT_AGG_WEEKLY_xx associated with the m_FACT_PRODUCT_AGG_WEEKLY_xx mapping.

2) Link the dcn_RUN_WEEKLY decision task to the s_m_FACT_PRODUCT_AGG_WEEKLY_xx session task.

3) Double-click the link.

a) Add a link condition that checks to see if the dcn_RUN_WEEKLY decision task has returned a value of TRUE, meaning that it is time to load the weekly aggregate table. See the figure below for details

Figure 5: Link Condition testing for a Decision Task condition of TRUE:

4) Edit the FACT_PRODUCT_AGG_WEEKLY_xx session.

a) Set the relational connection value for the SQ_SC_FACT_PRODUCT_AGG_DAILY source to EDWxx.

b) Set the relational connection value for the FACT_PRODUCT_AGG_WEEKLY target to EDWxx.

c) Verify that the Target load type is set to Normal.

d) In the Properties tab, set the Incremental Aggregation option to on.

Step 6. Add an Email Task

1) Add an Email task to the workflow.

2) Link the dcn_RUN_WEEKLY decision task to the Email Task

3) Double-Click the link.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 210: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

202 Lab 11 – wf_Fact_Product_Agg_Weekly_xx PowerCenter 9x Level I Developer

a) Add a link condition that checks to see if the dcn_RUN_WEEKLY decision task has returned a value of FALSE, meaning that the daily load has completed and that it is NOT time to load the weekly aggregate table.

4) Edit the Email Task.

a) Rename it to eml_DAILY_LOAD_COMPLETE.

b) In the Properties tab,

(i) Add [email protected] as the Email User Name.

(ii) Add appropriate text for the Email Subject and Email Text. See the figure below for details.

Figure 6: Email Task Properties:

5) Right-Click in the workspace and Arrange Horizontal.

6) Save your work.

7) Your workspace should appear the same as displayed below:

Figure 7: Completed Workflow:

Step 7. Start the Workflow and Monitor the Results

1) The workflow will need to be run seven times in order to see the weekly aggregate session running

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 211: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 11 – wf_Fact_Product_Agg_Weekly_xx 203

a) Start the workflow

b) Review the workflow in the Gantt view of the Workflow Monitor. It should appear similar to the figure below:

Figure 8: Gantt Chart of the Completed Workflow Run:

2) Return to the Workflow Manager.

3) Right-Click on the wkf_FACT_PRODUCT_AGG_WEEKLY_xx workflow in the navigator window and select View Persistent Values. The value should be set to 1. See the figures below:

Figure 9: View Workflow Variable Values:

Note: Each time you execute the workflow, this value will increment by one.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 212: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

204 Lab 11 – wf_Fact_Product_Agg_Weekly_xx PowerCenter 9x Level I Developer

Figure 10: Value of the $$WORKFLOW_RUNS variable after the first run:

4) Click Cancel to Exit.

5) Run the workflow six more times to emulate a week’s normal runs and after the last run the Task View should be similar to the figure below:

Figure 11: Task View of the Completed Workflow run after the weekly load runs.

6) Review the session properties of the s_m_FACT_PRODUCT_AGG_WEEKLY_xx session

Figure 12: Properties of the Completed session run:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 213: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 12.1 – m_STG_Employees_Parm_xx 205

Lab 12.1: Using Parameter Files to load STG Employees Target

Scenario:

The Tech Lead of Mersche Motors data warehouse has analyzed the logic of a mapping that could be enhanced by utilizing a parameter file. The Tech Lead has determined new standards for the Mersche Motors data warehouse which specifies that all log files must be parameterized and copied to a subject area directory. Source and target names should also be parameterized as well as database connections. If mapping logic can be used in more than one mapping or changes often, it should also be added to the parameter file.

Technical Description: In this exercise, you will move expression transformation logic into a session-level

parameter file in order to increase the flexibility of the mapping. This mapping will handle changing expressions by using the IsExprVar property. Variables will be used in the session as well to parameterize the source files and database connection. Students will copy the mapping from DEV_SHARED, then add mapping variables as well as edit the expression transformation to point gender, phone formatting and age range to those variables. A session parameter file will be created to calculate these expressions.

Goals:

Ascertain the use of the IsExprVar property in a mapping. Determine the structure of a parameter file. Establish the use of parameter files in mappings and sessions Prove the flexibility of using parameter files to build mapping expression logic.

Duration:

45 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 214: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

206 Lab 12.1 – m_STG_Employees_Parm_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Copy the mappings

1) Copy the m_STG_EMPLOYEES_Parm_xx mapping from the DEV_SHARED folder.

2) Select Yes for any Target Dependencies.

3) Select Reuse to resolve any conflicts.

4) Rename the mappings to include your student number.

5) Save your work.

Step 2. Create the Mapping Variables

1) Open the m_STG_EMPLOYEES_Parm_xx mapping.

a) Right-click and Arrange All Iconic.

b) Your mapping should appear similar to the figure below:

Figure 1: m_STG_EMPLOYEES_Parm_xx

2) Now you will create the mapping variables to store the logic of the previous ports.

3) Select Mappings Parameters and Variables.

4) Add a Variable called $$NAME.

a) Datatype = string

b) Precision = 600

c) Aggregation = Max

d) IsExprVar = True

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 215: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 12.1 – m_STG_Employees_Parm_xx 207

5) Add a Variable called $$PHONE.

a) Datatype = string

b) Precision = 600

c) Aggregation = Max

d) IsExprVar = True

6) Add a Variable called $$GENDER.

a) Datatype = string

b) Precision = 600

c) Aggregation = Max

d) IsExprVar = True

7) Add a Variable called $$AGE_GROUP.

a) Datatype = string

b) Precision = 600

c) Aggregation = Max

d) IsExprVar = True

8) Your Variables should appear similar to the figure below:

Figure 2: Variables for m_STG_EMPLOYEES_Parm_xx:

9) Click OK.

10) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 216: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

208 Lab 12.1 – m_STG_Employees_Parm_xx PowerCenter 9x Level I Developer

Step 3. Edit the Mapping

1) Double-Click the exp_Format_Name_Gender_Phone expression to edit it.

2) Click on the ports tab

a) Note the logic within the expressions of the out_NAME, out_PHONE, out_GENDER, out_AGE_GROUP ports.

3) Edit the out_NAME port

a) Cut the logic out of the port and paste it into a notepad file.

b) Replace the logic with $$NAME

4) Edit the out_PHONE port

a) Cut the logic out of the port and paste it into a notepad file.

b) Replace the logic with $$PHONE

5) Edit the out_GENDER port

a) Cut the logic out of the port and paste it into a notepad file.

b) Replace the logic with $$GENDER

6) Edit the out_AGE_GROUP port

a) Cut the logic out of the port and paste it into a notepad file.

b) Replace the logic with $$AGE_GROUP

7) Your notepad file should appear similar to the figure below:

Figure 3: Notepad file with logic from the four ports of the exp_FORMAT_Name_Gender_Phone expression:

8) Minimize the untitled notepad file.

9) Save the PowerCenter Repository.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 217: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 12.1 – m_STG_Employees_Parm_xx 209

Step 4. Create a Parameter File

1) Navigate to C:\infa_shared\ParmFiles\.

2) Open the Employees_Parm_xx.txt file.

a) Note: Employees_Parm.txt contains a format for the parameter file. When we are finished, this parameter file will contain parameters for the mapping, session and workflow.

3) The Employees_Parm_xx_txt file should appear the same as the figure below:

Figure 4: C:\infa_shared\ParmFiles\ Employees_Parm_xx.txt file:

4) Perform a Save As on the Employees_Parm_xx.txt file and rename it replacing the ‘xx’ with your student number.

5) Change ‘xx’ within the file to reflect your student number in the references to the folder names, workflow names and session names.

Note: Devxx reflects the folder name as stated in the lecture. It is important that the folder name be changed to reflect your folder in the repository (i.e. the one you have been using in the PowerCenter Designer and Workflow Manager.

6) According to our requirements, we must first parameterize the workflow log.

a) Under the entry for the workflow, add the entry to parameterize the workflow log. That entry appears below:

(i) $PMWorkflowLogFile=$PMRootDir\WorkflowLogs\wf_m_EMPLOYEES_Parm_xx.log.bin

Note: xx reflects your student number.

7) According to the requirements, you will now parameterize the target database connection

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 218: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

210 Lab 12.1 – m_STG_Employees_Parm_xx PowerCenter 9x Level I Developer

a) Under the entry for the session, add the entry to parameterize the target database connection. That entry appears below:

(i) $DBConnectionTarget=STGxx, where xx is your student id.

8) Add the parameter for the source file name.

a) $InputFileName=employees_list.txt

9) Now we will parameterize the mapping logic in the mapping, which is associated with the session.

a) Add parameters to the parameter file for each variable port in the mapping.

b) Maximize the untitled notepad file. Copy and paste the logic for each port after each appropriate parameter.

Note: it is important not to add any carriage returns within the variable port logic for each parameter.

10) When you are finished, your parameter file should appear similar to the figure below:

Figure 5: Employees_Parm_xx.txt after parameters have been added:

11) Save the file.

Step 5. Create the Workflow

1) Navigate to the Workflow Manager.

2) Create a workflow named wf_m_EMPLOYEES_Parm_xx. The workflow should contain a session named s_m_STG_EMPLOYEES_Parm_xx that is associated with the m_STG_EMPLOYEES_Parm_xx mapping.

3) Edit the workflow.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 219: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 12.1 – m_STG_Employees_Parm_xx 211

a) On the Properties tab

(i) Modify the Parameter Filename Attribute to point to the newly created parameter file.

(ii) Change the Workflow Log File Name Attribute to point to the newly created Workflow Log Name parameter.

(iii) Your Workflow Properties should appear similar to the figure below:

Figure 6: Workflow Properties for wf_m_EMPLOYEES_Parm_xx:

b) Click OK.

4) Edit the session.

a) On the Mapping tab

(i) Select SQ_employees_layout.

(ii) On the right-side Properties section; change Source Filetype to Indirect.

(iii) Change the Source Filename to reflect the parameter, $InputFileName.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 220: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

212 Lab 12.1 – m_STG_Employees_Parm_xx PowerCenter 9x Level I Developer

5) Select the target STG_EMPLOYEES

a) On the right-side Properties, change the Target Load Type to Normal.

b) Select Truncate Target Table Option.

c) Change the Connection Value to reflect the appropriate parameter, $DBConnectionTarget, as shown in the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 221: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 12.1 – m_STG_Employees_Parm_xx 213

Figure 7: Change Relational Connection to Use Connection Variable:

d) When you are finished, your Target Properties should appear similar to the figure below:

Figure 8: Target Properties for STG_EMPLOYEES:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 222: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

214 Lab 12.1 – m_STG_Employees_Parm_xx PowerCenter 9x Level I Developer

6) Click OK.

7) Save your work.

Step 6. Start the Workflow and Monitor the Results

1) Start the workflow

2) Review the session properties.

a) Your information should appear as displayed in the figure below.

Figure 9: Properties for the Completed Session Run

3) Review the Session Log

a) Note the Override values that were used for the session.

Figure 10: Session Log for s_m_STG_EMPLOYEES_parm:

b) Close the session log

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 223: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 12.1 – m_STG_Employees_Parm_xx 215

4) Open the Workflow Log

a) Note the name of the parameter file and the notification of the use of session overrides.

Figure 11: Workflow Log for wf_m_EMPLOYEES_Parm:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 224: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

216 Lab 12.1 – m_STG_Employees_Parm_xx PowerCenter 9x Level I Developer

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 225: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 12.2 – m_DIM_Employees_Parm_xx 217

Lab 12.2: Using Parameter Files to load the DIM Employees Target

Scenario:

The Tech Lead of Mersche Motors data warehouse has decided to add the mapping and session which loads the Employees dimension table to the previous workflow. He also determines it would be best to add variables and parameters for this load logic to the newly created parameter file.

Technical Description: Make the DIM_EMPLOYEES load more flexible by adding mapping, session and

workflow variables. The mapping will use a $$DATE_ENTERED variable to increment the daily load in a source qualifier override. This variable will be defined in the parameter file. The session associated with this mapping will be added previously created workflow in order to execute both the staging and dimension loads for the Employees within one workflow.

Goals:

Ascertain the use of the IsExprVar property in a mapping. Determine the structure of a parameter file. Establish the use of parameter files in mappings and sessions Prove the flexibility of using parameter files to build mapping expression logic.

Duration:

45 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 226: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

218 Lab 12.2 – m_DIM_Employees_Parm_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Copy the mappings

1) Copy the m_DIM_EMPLOYEES_Parm_xx mapping from the DEV_SHARED folder.

2) Select Yes for any Target Dependencies.

3) Select Reuse to resolve any conflicts.

4) Rename the mappings to include your student number.

5) Save your work.

Step 2. Edit the Mapping

1) Open the m_DIM_EMPLOYEES_Parm_xx mapping.

a) Right-click and Arrange All Iconic.

b) Your mapping should appear similar to the figure below:

Figure 1: m_DIM_EMPLOYEES_Parm_xx

2) Edit the lkp_DIM_DATES_Inserts and lkp_DIM_DATES_Updates Lookup transformations

a) Ensure that the Cache File Name Property is set to LKPSTUxx.

3) Mappings Parameters and Variables from the menu and create a mapping variable $$DATE_ENTERED to store the value of STG_EMPLOYEES.DATE_ENTERED.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 227: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 12.2 – m_DIM_Employees_Parm_xx 219

This is the date that will be used to incrementally load the DIM_EMPLOYEES table.

Figure 2: $$DATE_ENTERED Mapping Variable Definition:

4) Double-Click the SQ_STG_EMPLOYEES source qualifier to edit it.

a) Click on the Properties tab

b) Add the logic within the Source Filter to incrementally load records based on the DATE_ENTERED column of STG_EMPLOYEES.

STG_EMPLOYEES.DATE_ENTERED = '$$DATE_ENTERED'.

c) Click OK.

5) The $$DATE_ENTERED port will need to be declared in the exp_NULL_EMPLOYEE_ID expression transformation and then used (linked) in the router as shown below:

6) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 228: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

220 Lab 12.2 – m_DIM_Employees_Parm_xx PowerCenter 9x Level I Developer

Step 3. Edit the Parameter File

1) Open the C:\infa_shared\ParmFiles\Employees_Parm_xx.txt file.

2) The Employees_Parm_xx_txt file should appear similar to the figure below:

Figure 3: C:\infa_shared\ParmFiles\ Employees_Parm_xx.txt file:

3) Edit the parameter file to contain parameters for the s_m_DIM_EMPLOYEES_Parm_xx session:

a) Source database connection: $DBConnectionSource=STGxx

b) Target database connection: $DBConnectionTarget=EDWxx

c) Mapping variable $$DATE_ENTERED. $$DATE_ENTERED variable should be given a start date of ‘01/02/2003’

Note: In production, this date can be determined by a script that is located on the Informatica Server. Here in Development, we have hard-coded it. The operating system of the Informatica Server will determine what type of code and logic would be required for such a load date script.

4) Your parameter file should look similar to the figure below:

WF: and the name of the Workflow as it appears in the Workflow Designer are required.

WF: and ST: and the name of the Workflow and Session as it appears in the Workflow Designer are required.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 229: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 12.2 – m_DIM_Employees_Parm_xx 221

5) Save the file.

Step 4. Edit the Workflow

1) Navigate to the Workflow Manager.

2) If it is not already open, open workflow wf_m_EMPLOYEES_Parm_xx. The workflow should contain a session named s_m_STG_EMPLOYEES_Parm_xx that is associated with the m_STG_EMPLOYEES_Parm_xx mapping.

3) Add another session to the workflow. The session should be associated with

m_DIM_EMPLOYEES_Parm_xx mapping and should be named s_m_DIM_EMPLOYEES_Parm_xx.

4) Edit the session.

(i) Change the relational connections for the source, targets and lookups to the appropriate entries.

(ii) Truncate the relational targets.

(iii) The Writer target DIM_EMPLOYEES_ERR should be changed to File Writer, therefore it does not require a relational connection.

(iv) Your Connections for the session should appear similar to the figure below:

WF: and ST: and the name of the Workflow and Session as it appears in the Workflow Designer are required.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 230: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

222 Lab 12.2 – m_DIM_Employees_Parm_xx PowerCenter 9x Level I Developer

Figure 4: Connections for s_m_DIM_EMPLOYEES_Parm_xx:

5) Select the Source SQ_STG_EMPLOYEES

a) Ensure that the Source Filter appears the same as the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 231: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 12.2 – m_DIM_Employees_Parm_xx 223

Figure 5: Source Filter for SQ_STG_EMPLOYEES:

b) Click OK.

6) Link the s_m_STG_EMPLOYEES_Parm_xx and the s_m_DIM_EMPLOYEES_Parm_xx sessions.

7) Add a link condition the ensure that s_m_STG_EMPLOYEES_Parm_xx has a successful status before s_m_DIM_EMPLOYEES_Parm_xx executes.

8) Save your work.

Step 5. Start the Workflow and Monitor the Results

1) Start the workflow

2) Review the session properties.

a) Your information should appear as displayed in the figure below.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 232: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

224 Lab 12.2 – m_DIM_Employees_Parm_xx PowerCenter 9x Level I Developer

Figure 6: Properties for the Completed Session Run

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 233: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.1 – m_DIM_Customers_xx 225

Lab 13.1: Using a Dynamic Lookup and Error Logging to load the DIM Customers Target

Scenario:

Mersche Motors data warehouse has a customer table that is loaded on a daily basis. Many customers visit dealership locations more than once on a daily basis so the warehouse logic has to be able to track multiple visits on the same day. This logic must be able to test if a customer record has already been loaded in the current run and if so, what, if anything has changed about the customer.

Technical Description: PowerCenter will source from the table CUSTOMERS and load the dimension table

DIM_CUSTOMERS. Customer data may have more than one occurrence in the source. Data will have to be tested for new rows, existing rows and invalid rows. A Dynamic Lookup will need to be used since a customer row could occur more than once at the source. Some rows will have null data so flat file error logging will be used to capture these.

Goals:

Introduce Dynamic Lookups. Reinforce the use of Update Strategies. Introduce Error Logging.

Duration:

50 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 234: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

226 Lab 13.1 – m_DIM_Customers_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Source Definition Shortcut

1) Launch the Designer and login to your assigned folder.

2) Open the Source Analyzer workspace and select Clear All.

(i) Create a shortcut to the SDBU.CUSTOMERS source table found in the DEV_SHARED folder.

(ii) Rename it SC_CUSTOMERS.

3) Confirm that your source definition appears the same as displayed in the figure below:

Figure 1: Source Definition – SC_CUSTOMERS:

Step 2. Create a Relational Target Definition

1) Create a shortcut to the DIM_CUSTOMERS definition from the DEV_SHARED folder in your folder. Name the shortcut SC_DIM_CUSTOMERS.

2) Confirm that your target definition appears the same as displayed in the figure below:

Figure 2: Target Shortcut – SC_DIM_CUSTOMERS:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 235: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.1 – m_DIM_Customers_xx 227

Step 3. Create a Mapping

1) Open the Mapping Designer.

2) Create a new mapping named m_DIM_CUSTOMERS_xx

3) Add the SC_CUSTOMERS source definition.

4) Add the SC_DIM_CUSTOMERS target definition.

5) Save your work.

Step 4. Create a Lookup Transformation

1) Create a new Lookup transformation using the SC_DIM_CUSTOMERS table.

2) Drag the lookup window and make it taller.

3) Select all ports from SQ_SC_CUSTOMERS and drop them on to an empty port at the bottom of the Lookup.

4) Edit the Lookup transformation

a) Rename it lkp_DIM_CUSTOMERS

b) Select the Properties tab

(i) Click on the Dynamic Lookup Cache Value.

(ii) Click on the Insert Else Update value.

(iii) Your Properties tab should look similar to the figure below:

Figure 3: Lkp_DIM_CUSTOMERS Properties Tab:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 236: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

228 Lab 13.1 – m_DIM_Customers_xx PowerCenter 9x Level I Developer

c) Select the Ports tab

(i) For all ports from the SQ_SC_CUSTOMERS prefix them with IN_ and remove the ‘1’ form the end of the name as shown in the figure below:

Figure 4: Lkp_DIM_CUSTOMERS Ports Tab:

d) Select the Condition tab

(i) Create the condition CUST_ID = IN_CUST_ID.

e) Select the Ports tab again; It should look the same as the figure below. Notice the new port entry called NewLookupRow.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 237: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.1 – m_DIM_Customers_xx 229

Figure 5: Port Tab view of a Dynamic Lookup:

Note: Dynamic lookups allow for inserts and updates to take place in cache as the same operations take place against the target table.

Note: The Associated port column is there to allow the association of input ports with lookup ports of different names. This enables PowerCenter to update the Lookup Cache will correct values.

Note: NewLookupRow is used to store the values 0, 1, 2

0 = No Change

1 = Insert

2 = Update

f) Under the Associated Port column, click the box where it says “N/A” and select the port names from the list that you want to associate. See the figure below:

Figure 6: Port to Port Association:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 238: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

230 Lab 13.1 – m_DIM_Customers_xx PowerCenter 9x Level I Developer

g) Associate the remaining ports.

h) Clear the Output checkmarks for all of the ports prefixed with “IN_”.

5) Click OK and save your work

6) Your mapping should appear similar to the figure below:

Figure 7: m_DIM_CUSTOMERS Source Qualifier to Dynamic Lookup

Step 5. Create a Filter Transformation

1) Create a Filter transformation named fil_ROWS_UNCHANGED.

2) Drag all output ports from the Lookup transformation to the Filter transformation.

3) Create a condition that allows all rows that are marked for update or insert, or all rows where the CUST_ID is NULL to pass through. Any rows where NewLookupRow != 0 are deemed to be inserts or updates. If you need any assistance refer to the reference section at the end of the lab.

4) Your mapping should appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 239: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.1 – m_DIM_Customers_xx 231

Figure 8: M_DIM_CUSTOMERS mapping with Filter:

Step 6. Create an Update Strategy

1) Create an Update Strategy transformation named upd_DIM_CUSTOMERS.

2) Drag all ports from the Filter transformation to the Update Strategy transformation.

3) Edit the upd_DIM_CUSTOMERS Update Strategy transformation.

a) Add an Update Strategy Expression that marks the rows as an insert, update, or reject. Use the following pseudo code to construct your expression. If you need assistance, refer to the reference section at the end of this lab.

If CUST_ID is null, then reject the row, Else If NewLookupRow equals 1 then mark the row for insert Else If NewLookupRow equals 2, then mark the row for update.

b) Ensure the Forward Rejected Rows option is checked. This will send any rejected rows to error logs which will be created later.

4) Autolink ports by name to the SC_DIM_CUSTOMERS target.

5) Save your work.

Figure 9: Iconic view of the completed mapping:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 240: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

232 Lab 13.1 – m_DIM_Customers_xx PowerCenter 9x Level I Developer

Step 7. Create and Execute the Workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) Create a new workflow named wf_DIM_CUSTOMERS_xx.

3) Edit the session s_m_DIM_CUSTOMERS_xx

a) Set the connection value for SQ_SC_CUSTOMERS to SDBU.

b) Set the connection value for SC_DIM_CUSTOMERS to EDWxx.

c) Set the Load Target Type to Normal.

d) In the Config Object tab:

(i) Change Error Handling section for the Error Log Type from None to Flat File as shown in the figure below.

(ii) Change the Error Log File Name to PMErrorxx.log.

Figure 10: Config Object Error Logging selections:

4) Save your work and start the workflow

Note: In a Production environment, error logging tables and files would be created in a different schema or location than the production schema or file location.

5) Review the session properties, your information should appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 241: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.1 – m_DIM_Customers_xx 233

Figure 11: Properties of the Completed Session Run:

Step 8. Review Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 12: Data Preview of the DIM_CUSTOMERS Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 242: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

234 Lab 13.1 – m_DIM_Customers_xx PowerCenter 9x Level I Developer

Step 9. Error Log Results

1) The error log is written to the BadFiles directory on the PowerCenter Server under the default name of PMErrorxx.log. Look in this location for the error log and look at the rows that were written there. The log should appear similar to the figure below:

Figure 13: Flat File Error Log:

Reference

2) Fil_ROWS_UNCHANGED Condition

a) NewLookupRow != 0 or ISNULL(CUST_ID)

3) Upd_DIM_CUSTOMERS Expression

a) IIF(ISNULL(CUST_ID), DD_REJECT, IIF(NewLookupRow = 1, DD_INSERT, IIF(NewLookupRow = 2, DD_UPDATE)))

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 243: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.2 – m_DIM_Vendor_Product_xx 235

Lab 13.2: Error Handling

Scenario:

Mersche Motors data warehouse would like to track which records are failing when trying to run a load from the PRODUCT Flat File to the DIM_VENDOR_PRODUCT table. Also some of the developers have noticed “dirty data” being loaded into the DIM_VENDOR_PRODUCT table, therefore users are getting “dirty data” in their reports.

Technical Description: We will route the Fatal Errors off to a Fatal Error table and route the Nonfatal

Errors off to a Nonfatal table. All “good” data will be sent to the EDW. This will be achieved by creating a flag for both fatal and nonfatal errors. Route bad data to its respective physical database table.

Goals:

Trap all database errors and load them to a table called ERR_FATAL. Trap the “dirty data” coming through from the CATEGORY field and write it to a

table called ERR_NONFATAL. Write all data without fatal or nonfatal errors to DIM_VENDOR_PRODUCT.

Duration:

60 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 244: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

236 Lab 13.2 – m_DIM_Vendor_Product_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Source Definition Shortcut

1) Launch the Designer and login to your assigned folder.

2) Open the Source Analyzer workspace and select Clear All.

(i) Create a shortcut to the PRODUCT source flat file found in the DEV_SHARED folder.

(ii) Rename it SC_PRODUCT.

Step 2. Create a Relational Target Definition

1) Create a shortcut to the DIM_VENDOR_PRODUCT definition from the DEV_SHARED folder in your folder. Name the shortcut SC_DIM_VENDOR_PRODUCT.

2) Create a shortcut to the ERR_NONFATAL definition from the DEV_SHARED folder in your folder. Name the shortcut SC_ERR_NONFATAL.

3) Create a shortcut to the ERR_FATAL definition from the DEV_SHARED folder in your folder. Name the shortcut SC_ERR_FATAL.

Step 3. Create a Mapping

1) Open the Mapping Designer.

2) Create a new mapping named m_DIM_VENDOR_PRODUCT_xx

3) Add the SC_PRODUCT source definition.

4) Add the SC_DIM_VENDOR_PRODUCT target definition.

5) Add the SC_ ERR_NONFATAL target definition.

6) Add the SC_ ERR_FATAL target definition.

7) Save your work.

Step 4. Create an Expression Transformation

1) Create an Expression Transformation named exp_ERR_TRAPPING.

2) Copy all of the output ports from SQ_FATAL_PRODUCT to exp_ERR_TRAPPING.

New output ports need to be created to test for erroneous records. Your current business requirements state that you need to check for null PRODUCT_CODE and null CATEGORY. If more error requirements are gathered later, you can add that logic to this expression. You will also need to create a port that will capture the error record. All columns from the error record will need to be concatenated into this port.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 245: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.2 – m_DIM_Vendor_Product_xx 237

3) Click on the ports tab and create 3 new output ports.

a) Output port #1

(i) Name = out_INVALID_PRODUCT_CODE

(ii) Datatype = string

(iii) Precision = 10

(iv) Expression = IIF(ISNULL(PRODUCT_CODE),'FATAL','GOOD DATA')

(v)

b) Output port #2

(i) Name = out_INVALID_CATEGORY

(ii) Datatype = string

(iii) Precision = 10

(iv) Expression = IIF(ISNULL(CATEGORY), 'NONFATAL', 'GOOD DATA')

c) Output port #3

(i) Name = out_ERR_RECORD

(ii) Datatype = string

(iii) Precision = 500

(i) Expression = TO_CHAR(PRODUCT_CODE) || '|' || CATEGORY || '|' ||TO_CHAR(VENDOR_ID) || '|' || PRODUCT_NAME || '|' || MODEL || '|' || TO_CHAR(PRICE) || '|' || TO_CHAR(COST) || '|' || TO_CHAR(DISCONTINUED_FLAG) || '|' || DATA_PULL_DATE || '|' || TO_CHAR(REC_NUM)

4) Your ports tab should be similar to the figure below:

Figure 1: Exp_ERR_TRAPPING Ports Tab:

5) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 246: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

238 Lab 13.2 – m_DIM_Vendor_Product_xx PowerCenter 9x Level I Developer

Step 5. Create a Lookup Transformation

1) Create a new Lookup transformation using the ODS_VENDOR table.

2) Copy the VENDOR_ID port from exp_ERR_TRAPPING expression transformation to an empty port on lkp_ODS_VENDOR.

a) Rename the new port to in_VENDOR_ID

3) The lookup condition should be VENDOR_ID = in_VENDOR_ID

a) The lookup transformation details are as follows:

Lookup Name lkp_ODS_VENDOR

Lookup Table Name

ODS_VENDOR Location

ODSxx

Description The VENDOR_NAME, FIRST_CONTACT and VENDOR_STATE are needed to populate DIM_VENDOR_PRODUCT.

Match Condition(s)

ODSxx.VENDOR_ID = PRODUCT.in_VENDOR_ID

Filter/ SQL Override

N/A

Output Value(s) VENDOR_NAME, FIRST_CONTACT and VENDOR_STATE

4) Save your work.

5) lkp_ODS_VENDOR should appear similar to the figure below:

Figure 2: lkp_ODS_VENDOR Normal View:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 247: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.2 – m_DIM_Vendor_Product_xx 239

Step 6. Create a Router Transformation

1) Create a Router transformation named rtr_PRODUCT_DATA.

2) All output rows, except COST, from exp_ERR_TRAPPING should be copied to the input group of rtr_PRODUCT_DATA.

3) VENDOR_NAME, FIRST_CONTACT and VENDOR_STATE should be copied from lkp_ODS_VENDOR to the input group of rtr_PRODUCT_DATA.

4) Create groups

a) Group #1 = NONFATAL_ERRORS

(i) out_INVALID_CATEGORY='NONFATAL'

b) Group #2 = FATAL_ERRORS

(i) Out_INVALID_PRODUCT_CODE='FATAL'

The default group will contain rows that do not match the above conditions, hence all good rows.

Your router Groups tab should appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 248: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

240 Lab 13.2 – m_DIM_Vendor_Product_xx PowerCenter 9x Level I Developer

5) Your mapping should appear similar to the figure below:

Figure 3: exp_ERR_TRAPPING, lkp_ODS_VENDOR, rtr_PRODUCT_DATA:

Step 7. Create an Expression Transformation

1) Create an Expression Transformation named exp_ERR_NON_FATAL.

2) Copy PRODUCT_CODE1 from the NON_FATAL_ERRORS router group to exp_ERR_NON_FATAL.

3) Create output ports

a) Output Port #1

(i) Name = out_ERR_DESCRIPTION

(ii) Datatype = String

(iii) Precision = 20

(iv) Expression = ‘INVALID CATEGORY’

b) Output Port #2

(i) Name = out_LOAD_DATE

(ii) Datatype = DateTime

(iii) Expression = SESSSTARTTIME

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 249: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.2 – m_DIM_Vendor_Product_xx 241

Step 8. Create a Sequence Generator

1) Create a Sequence Generator named seq_NONFATAL

2) Link the NEXTVAL port of the sequence generator to the ERR_ID port of SC_ERR_NONFATAL target.

Step 9. Connect NonFatal Router Group and Expression to Target

1) Connect the NONFATAL Router Group to the Target

a) Connect rtr_PRODUCT_DATA.NON_FATAL_ERRORS.REC_NUM1 port to SC_ERR_NONFATAL.REC_NBR

b) Connect rtr_PRODUCT_DATA.NON_FATAL_ERRORS.out_ERR_RECORD1 port to SC_ERR_NONFATAL.ERR_RECORD

2) Connect exp_ERR_NONFATAL expression to SC_ERR_NONFATAL target

a) Connect exp_ERR_NONFATAL.out_ERR_DESCRIPTION to SC_ERR_NONFATAL.ERR_DESCRIPTION

b) Connect exp_ERR_NONFATAL.out_LOAD_DATE to SC_ERR_NONFATAL.LOAD_DATE.

3) Your mapping should appear similar to the figure below:

Figure 4: m_DIM_VENDOR_PRODUCT_xx:

Step 10. Create Expression Transformation

1) Create an Expression Transformation named exp_ERR_FATAL.

2) Copy PRODUCT_CODE3 from the FATAL_ERRORS router group to exp_ERR_FATAL.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 250: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

242 Lab 13.2 – m_DIM_Vendor_Product_xx PowerCenter 9x Level I Developer

3) Create output ports

a) Output Port #1

(i) Name = out_ERR_DESCRIPTION

(ii) Datatype = String

(iii) Precision = 20

(iv) Expression = ‘'NULL VALUE IN KEY'’

b) Output Port #2

(i) Name = out_LOAD_DATE

(ii) Datatype = DateTime

(iii) Expression = SESSSTARTTIME

Step 11. Create a Sequence Generator

1) Create a Sequence Generator named seq_FATAL

2) Link the NEXTVAL port of the sequence generator to the ERR_ID port of SC_ERR_FATAL target.

Step 12. Connect Fatal Router Group and Expression to Target

1) Connect the FATAL Router Group to the Target

a) Connect rtr_PRODUCT_DATA.FATAL_ERRORS.REC_NUM3 port to SC_ERR_FATAL.REC_NBR

b) Connect rtr_PRODUCT_DATA.FATAL_ERRORS.out_ERR_RECORD3 port to SC_ERR_FATAL.ERR_RECORD

2) Connect exp_ERR_FATAL expression to SC_ERR_FATAL target

a) Connect exp_ERR_FATAL.out_ERR_DESCRIPTION to SC_ERR_FATAL.ERR_DESCRIPTION

b) Connect exp_ERR_FATAL.out_LOAD_DATE to SC_ERR_FATAL.LOAD_DATE.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 251: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.2 – m_DIM_Vendor_Product_xx 243

3) Your mapping should appear similar to the figure below:

Step 13. Connect the Router Default Group to the Target

1) Connect the ports from rtr_PRODUCT_DATA.Default1 to SC_DIM_VENDOR_PRODUCT.

2) Autolink by Name with a suffix of ‘2’

3) Your mapping should appear as shown below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 252: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

244 Lab 13.2 – m_DIM_Vendor_Product_xx PowerCenter 9x Level I Developer

4) Right Click and Arrange All Iconic

Step 14. Create and Execute the Workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) Create a new workflow named wf_m_DIM_VENDOR_PRODUCT_xx.

3) Edit the session s_m_DIM_VENDOR_PRODUCT_xx

a) Set the Source File Name value for SQ_PRODUCT to FATAL_PRODUCT.txt.

b) Set the connection value for each of the targets to EDWxx.

c) Set the Load Target Type to Normal for each target.

d) Set the connection value for lkp_ODS_VENDOR to ODSxx.

4) Save your work and start the workflow

5) Review the session properties, your information should appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 253: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 13.2 – m_DIM_Vendor_Product_xx 245

Figure 5: Properties of the Completed Session Run:

Step 15. Review Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 6: Data Preview of the DIM_VENDOR_PRODUCT Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 254: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

246 Lab 13.2 – m_DIM_Vendor_Product_xx PowerCenter 9x Level I Developer

Figure 7: Data Preview of the ERR_FATAL Target Table:

Figure 8: Data Preview of the ERR_NONFATAL Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 255: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 14 – m_ODS_Customer_Billing_xx 247

Lab 14: More Lookups

Scenario:

Mersche Motors management needs a report to determine the total amount each customer owes the company regardless of where the sale took place. A system date is also required so that management will know how much the customer owes on a certain date. Management would also like to get a total of all the orders each customer has with the company as well.

Technical Description: A multiple row return lookup will be used in conjunction with an aggregator to

achieve this calculation.

Goals:

Exam and use Informatica v9 multiple row return lookups.

Duration:

30 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 256: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

248 Lab 14 – m_ODS_Customer_Billing_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Create a Source Definition Shortcut

1) Launch the Designer and login to your assigned folder.

2) Open the Source Analyzer workspace and select Clear All.

(i) Create a shortcut to the ODS_CUSTOMERS relational table found in the DEV_SHARED folder.

(ii) Rename it SC_ODS_CUSTOMERS.

Step 2. Create a Relational Target Definition

1) Create a shortcut to the ODS_CUSTOMER_BILLING definition from the DEV_SHARED folder in your folder. Name the shortcut SC_ODS_CUSTOMER_BILLING.

Step 3. Create a Mapping

1) Open the Mapping Designer.

2) Create a new mapping named m_ODS_CUSTOMER_BILLING_xx

3) Add the SC_ODS_CUSTOMERS source definition.

4) Add the SC_ODS_CUSTOMER_BILLING target definition.

5) Save your work.

Step 4. Create a Lookup Transformation

1) Create an Lookup Transformation named MultiRowLkp_CUSTOMER_ORDERS.

2) On the Select Lookup Table for Lookup Transformation dialog box, Select the Return All Values on Multiple Match checkbox.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 257: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 14 – m_ODS_Customer_Billing_xx 249

3) Import the lookup table from SDBU.CUSTOMER_ORDERS.

4) Select all of the output ports from SQ_SC_ODS_CUSTOMERS and copy them to an empty port on the lookup.

5) Set the Lookup Condition to CUST_ID = CUSTOMER_NO

6) Select the Properties tab

a) Note that the Lookup Policy on Multiple Match is greyed out and has a value of ‘Use All Values’.

7) Click on the Ports tab

8) Ensure that CUST_ID, ORDER_NO and UNIT_COST are all configured as lookup ports as shown below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 258: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

250 Lab 14 – m_ODS_Customer_Billing_xx PowerCenter 9x Level I Developer

9) Click OK.

10) Save your work.

Step 5. Create an Aggregator Transformation

1) Create an Aggregator Transformation called agg_ODS_CUSTOMERS.

2) Ports to copy from Lookup to the aggregator transformation:

a) CUST_ID

b) ORDER_NO

c) DEALERSHIP_ID

d) CUSTOMER_NO

e) NAME

f) POSTAL_CODE

g) CONTACT_DATE

h) GENDER_CATEGORY

i) SENIOR_FLAG

j) HIGH_INCOME_FLAG

k) UNIT_COST

3) Group by CUST_ID.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 259: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 14 – m_ODS_Customer_Billing_xx 251

4) Add 3 new output ports

a) Output Port #1

(i) Name = SUM_UNIT_COST

(ii) Datatype = Decimal

(iii) Precision = 35, 2

(iv) Expression = SUM(UNIT_COST)

(v)

b) Output Port #2

(i) Name = SYSTEMDATE

(ii) Datatype = DateTime

(iii) Expression = Sysdate

c) Output Port #3

(i) Name = COUNT_CUSTOMER_ORDERS

(ii) Datatype = Decimal

(iii) Precision = 10

(iv) Expression = COUNT(ORDER_NO)

d) Link the agg_ODS_CUSTOMER ports to the target as shown in the figure below:

5) Save your work.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 260: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

252 Lab 14 – m_ODS_Customer_Billing_xx PowerCenter 9x Level I Developer

Step 6. Create and Execute the Workflow

1) Launch the Workflow Manager and sign into your assigned folder.

2) Create a new workflow named wf_m_ODS_CUSTOMER_BILLING_xx.

3) Edit the session s_m_ODS_CUSTOMER_BILLING_xx

a) Set the relational connection value for SQ_SC_ODS_CUSTOMER to ODSxx.

b) Set the connection value for ODS_CUSTOMER_BILLING target to ODSxx.

c) Set the Load Target Type to Normal for each target.

d) Set the connection value for lkp_CUSTOMER_ORDERS to SDBU.

4) Save your work and start the workflow

5) Review the session properties, your information should appear similar to the figure below:

Figure 1: Properties of the Completed Session Run:

6) One record has rejected. Why?

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 261: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 14 – m_ODS_Customer_Billing_xx 253

Step 7. Review Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 2: Data Preview of the ODS_CUSTOMER_BILLING Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 262: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

254 Lab 14 – m_ODS_Customer_Billing_xx PowerCenter 9x Level I Developer

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 263: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 15 – m_FACT_Promotions_Agg_Daily_xx 255

Lab 15: Mapping Workshop

Scenario:

Mersche Motors management wants to be able to analyze how certain promotions are performing. They want to be able to gather the promotions by day for each dealership for each product being sold. The data warehouse now has the perfect architecture to deliver that information.

Technical Description: The instructions will provide enough detail for you to design and build the mapping

necessary to load the promotions aggregate table. It is suggested that you use the Velocity best practices that have been discussed during the course. The workshop will provide mapping specification documents that can be to design the mapping. If you are unclear on any instructions, please ask the instructor.

Goals:

Design and create a mapping to load an aggregate table.

Duration:

120 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 264: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

256 Lab 15 – m_FACT_Promotions_Agg_Daily_xx PowerCenter 9x Level I Developer

Velocity Deliverable: Mapping Specifications

Mapping Name:

Source System(s):

Target System(s):

Initial Rows: Rows/Load:

Short Description:

Load Frequency:

Preprocessing:

Post Processing:

Error Strategy:

Reload Strategy:

Unique Source Fields (PK):

Dependant Objects

SOURCES

Tables

Table Name System/Schema/Owner Selection/Filter

Files

File Name File Location Fixed/Delimited Additional File Info

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 265: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 15 – m_FACT_Promotions_Agg_Daily_xx 257

TARGETS

Tables Schema Owner

Table Name Update Delete Insert Unique Key

Files

File Name File Location Fixed/Delimited Additional File Info

LOOKUPS

Lookup Name

Table Location

Match Condition(s)

Persistent / Dynamic

Filter/SQL Override

HIGH LEVEL PROCESS OVERVIEW

<Insert high level diagram of process flow to show sequence of events>

PROCESSING DESCRIPTION (DETAIL)

<Describe processing logic contained in mapping >

Source Target

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 266: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

258 Lab 15 – m_FACT_Promotions_Agg_Daily_xx PowerCenter 9x Level I Developer

SOURCE TO TARGET FIELD MATRIX

Target System/

Table Target

Column Data type

Source System/

Table Source Column

Data type Expression

Default

Value if Null

Data Issues/ Quality

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 267: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 15 – m_FACT_Promotions_Agg_Daily_xx 259

Instructions

Step 1. Workshop Details

1) Sources and Targets

a) Source: TRANSACTIONS

b) This relational table contains sales transactions for 7 days. It exists in the SDBU schema and contains 5,475 records. For the purpose of this mapping, we will read all 7 days of data. See the figure below for the source table layout.

Figure 1: Source Table Definition:

c) Target: FACT_PROMOTIONS_AGG_DAILY

(i) This relational is located in the EDWxx schema. After executing the mapping, it should contain 1,073 records. See the figure below for the target table layout:

Figure 2: Target Table Definition:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 268: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

260 Lab 15 – m_FACT_Promotions_Agg_Daily_xx PowerCenter 9x Level I Developer

Step 2. Mapping Details

1) In order to successfully create the mapping, you will need to know some additional details.

a) The management has decided they don’t want to keep track of the Manager Discount or the Employee Discount (PROMO_ID 105 and 200) so these will need to be excluded from the load.

b) The PRODUCT_KEY can be obtained from the DIM_PRODUCT table by matching on the PRODUCT_ID.

c) The DATE_KEY can be obtained for the DIM_DATES table by matching the TRANSACTIONS_DATE to the DATE_VALUE.

d) UNITS_SOLD is derived by summing the SALES_QTY.

e) REVENUE is derived by taking the SALES_QTY times the SELLING_PRICE and then subtracting the DISCOUNT, HOLDBACK and REBATE.

(i) Most of the discounts are valid but occasionally they may be higher than the acceptable value of 17.25. When this occurs, you will need to obtain an acceptable value based on the PROMO_ID. The acceptable value can be obtained from the DIM_PROMOTIONS table by matching the PROMO_ID.

(ii) The DISCOUNT is a percentage stored as a number. To calculate the actual discount in dollars, you will need to divide the DISCOUNT by 100 and multiply it by the SELLING_PRICE.

f) REVENUE_PER_UNIT is derived by dividing the REVENUE by the sum of SALES_QTY.

g) COST is derived by summing the COST port from the TRANSACTIONS source.

h) COST_PER_UNIT is derived by summing the COST and diving it by the sum of the SALES_QTY.

i) Save your work often.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 269: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 15 – m_FACT_Promotions_Agg_Daily_xx 261

Step 3. Execution Details

1) Review the session properties, your information should appear similar to the figure below:

Figure 3: Properties of the Completed Session Run:

Step 4. Review Data Results

1) Preview the target data from the Designer. Your data should appear as displayed in the figure below:

Figure 4: Data Preview of the FACT_PROMOTIONS_AGG_DAILY Target Table:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 270: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

262 Lab 15 – m_FACT_Promotions_Agg_Daily_xx PowerCenter 9x Level I Developer

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 271: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 16 – wf_FileWatcher_xx 263

Lab 16: Workflow Workshop I

Scenario:

An Employee flat file is being used as a source to load an Employee target system. The source file appears at regular intervals. The Employee load session is executed when an indicator file is created as part of the nightly batch processes that create the Employee flat file. An indicator file is simply a file that indicates that the source file is ready to be loaded. Sometimes the latest Employee file may not be available for loading, perhaps due to a source dependency outside of Informatica. If the indicator file does not appear in a specified period of time, a notification should be sent and the wait for the file should be stopped.

Technical Description: Name your workflow wf_FileWatcher_xx. To implement this scenario, you will have to create a workflow with two branches. The primary branch of the workflow includes the file watcher Event-Wait task. The

Event Wait task will be triggered by the file-watch event (appearance of the indicator file). If the indicator file appears, the workflow should load the STG_EMPLOYEE table. After loading the table, an Email should be sent that states the table was loaded.

The secondary branch completes execution if the indicator file does not appear within a specified time window. It begins with an Assignment task that assigns a time five minutes later than when the indicator file is scheduled to appear. After the Assignment task is a Timer task. The Timer waits for the time set in the Assignment task. When the time expires, an email should be sent that states that the table was NOT loaded.

In order to control the workflow branches, each will end in a Command Task. At the end of the primary branch (after the “success” email task), the command task should stop the Timer task, then stop the Workflow.

At the end of the secondary workflow branch (after the “not loaded” email task), the Command task should stop the workflow.

The secondary branch of the workflow should wait for five minutes for the indicator file to appear before sending the “not loaded” email and stopping the workflow.

In a real-life situation, the Assignment task would add five minutes to the time on the clock (e.g. 2:00AM plus five minutes) when the file was to have appeared. In this lab, please add five minutes to the built-in SYSDATE variable.

Please remember that the Integration Service will be looking for the indicator file relative to the machine upon which it executes – the Informatica server in this case. Therefore, you will have to place your indicator file upon the infa-server machine. You already have a mapped drive to that machine. Please place your indicator file on the mapped drive. Set the location of the file in the EventWait task to “C:\infa_shared\StudentxxIndcatorFile.txt” where xx is your student ID. You may want to use an editor such as Notepad to save the file to that location on demand as you test your workflow.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 272: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

264 Lab 16 – wf_FileWatcher_xx PowerCenter 9x Level I Developer

Goals:

Design and create a process to complete a workflow and send an email notification if a specified event does not occur in a given period of time. A workflow that uses an Event-Wait task to wait for a predefined or user-defined event, such as a file-watch event, may cause the Integration Service to wait indefinitely until that event has occurred. A workaround is required.

Duration:

60 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 273: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 16 – wf_FileWatcher_xx 265

Velocity Deliverable: Mapping Specifications

Mapping Name:

Source System(s):

Target System(s):

Initial Rows: Rows/Load:

Short Description:

Load Frequency:

Preprocessing:

Post Processing:

Error Strategy:

Reload Strategy:

Unique Source Fields (PK):

Dependant Objects

SOURCES

Tables

Table Name System/Schema/Owner Selection/Filter

Files

File Name File Location Fixed/Delimited Additional File Info

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 274: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

266 Lab 16 – wf_FileWatcher_xx PowerCenter 9x Level I Developer

TARGETS

Tables Schema Owner

Table Name Update Delete Insert Unique Key

Files

File Name File Location Fixed/Delimited Additional File Info

LOOKUPS

Lookup Name

Table Location

Match Condition(s)

Persistent / Dynamic

Filter/SQL Override

HIGH LEVEL PROCESS OVERVIEW

<Insert high level diagram of process flow to show sequence of events>

PROCESSING DESCRIPTION (DETAIL)

<Describe processing logic contained in mapping >

Source Target

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 275: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 16 – wf_FileWatcher_xx 267

SOURCE TO TARGET FIELD MATRIX

Target System/

Table Target

Column Data type

Source System/

Table Source Column

Data type Expression

Default

Value if Null

Data Issues/ Quality

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 276: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

268 Lab 16 – wf_FileWatcher_xx PowerCenter 9x Level I Developer

Instructions

Step 1. Workshop Details

1) Create a workflow variable

a) Create a datetime workflow variable named $$WAITTIME.

2) Workflow Tasks

a) The primary branch contains the following tasks:

(i) EventWait – Contains the path to the indicator file.

(ii) Session Task – That loads the STG_EMPLOYEE table.

(iii) Email Task 1 – Success email that states that the STG_EMPLOYEE table has been loaded. Have the email sent to your student ID (e.g. [email protected]). Make sure you have Windows Live Mail up and running as you test the Workflow.

(iv) Command Task 1 First command: Stops the Timer Task in the secondary branch when the session completes. Then it stops the workflow. Use the following PMCMD stoptask command to stop the Timer Task:

C:\Informatica\9.1.0\server\bin\pmcmd stoptask -sv IS_EDW_Dev -d Domain_infa-server -u Administrator -p admin -f Devxx -w YourWorkflowName Timer

Where YourWorkflowName is your workflow name and xx is you student ID.

(v) CommandTask1 Second command: Stops the workflow so that the failure email does not execute. C:\Informatica\9.1.0\server\bin\pmcmd stopworkflow -sv IS_EDW_Dev -d Domain_infa-server -u Administrator -p admin -f Devxx YourWorkflowName Where xx is your student ID and YourWorkflowName is the name of your workflow.

(vi) Configure the Command Task to fail if any command fails.

b) The secondary branch of the workflow contains the following tasks:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 277: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 16 – wf_FileWatcher_xx 269

(i) Assignment Task – Assigns a value to the $$WAITTIME datetime variable. Hint: Use the ADD_TO_DATE function to add five minutes to the built-in SYSDATE variable.

(ii) Timer Task – Waits until the time set by the $$WAITTIME variable.

(iii) Failure Email task – sends out an email indicating that the file did not appear.

(iv) Command Task 2 – Stops the workflow because the indicator has not appeared in the specified time using the command in 2.a.(v) above.

c) Link Conditions (optional)

If you wish, you may set link conditions to execute only if the previous task completed successfully.

Step 2. Workflow Details

1) Your workflow should appear similar to the figure below:

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 278: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

270 Lab 16 – wf_FileWatcher_xx PowerCenter 9x Level I Developer

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 279: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 17 – wf_Load_All_Staging_Tables_xx 271

Lab 17: Workflow Workshop II

Scenario:

Mersche Motors tech lead has indicated that all staging tables need to be loaded in a single workflow.

Technical Description: The instructions will provide enough detail for you to design and build the workflow

necessary to load all staging table in a single run. It is suggested that you use the Velocity best practices that have been discussed during the course. If you are unclear on any instructions, please ask the instructor.

Goals:

Design and create a workflow to load all of the staging tables.

Duration:

60 minutes

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 280: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

272 Lab 17 – wf_Load_All_Staging_Tables_xx PowerCenter 9x Level I Developer

Velocity Deliverable: Mapping Specifications

Mapping Name:

Source System(s):

Target System(s):

Initial Rows: Rows/Load:

Short Description:

Load Frequency:

Preprocessing:

Post Processing:

Error Strategy:

Reload Strategy:

Unique Source Fields (PK):

Dependant Objects

SOURCES

Tables

Table Name System/Schema/Owner Selection/Filter

Files

File Name File Location Fixed/Delimited Additional File Info

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 281: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 17 – wf_Load_All_Staging_Tables_xx 273

TARGETS

Tables Schema Owner

Table Name Update Delete Insert Unique Key

Files

File Name File Location Fixed/Delimited Additional File Info

LOOKUPS

Lookup Name

Table Location

Match Condition(s)

Persistent / Dynamic

Filter/SQL Override

HIGH LEVEL PROCESS OVERVIEW

<Insert high level diagram of process flow to show sequence of events>

PROCESSING DESCRIPTION (DETAIL)

<Describe processing logic contained in mapping >

Source Target

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 282: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

274 Lab 17 – wf_Load_All_Staging_Tables_xx PowerCenter 9x Level I Developer

SOURCE TO TARGET FIELD MATRIX

Target System/

Table Target

Column Data type

Source System/

Table Source Column

Data type Expression

Default

Value if Null

Data Issues/ Quality

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 283: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

PowerCenter 9x Level I Developer Lab 17 – wf_Load_All_Staging_Tables_xx 275

Instructions

Step 1. Workshop Details

1) Mapping Required

a) This section contains a list of the mappings that will be used in the workflow

(i) m_STG_PAYMENT_xx

(ii) m_STG_PRODUCT_xx

(iii) m_STG_DEALERSHIP _xx

(iv) m_STG_CUSTOMER_CONTACTS_xx

(v) m_STG_TRANSACTIONS_xx

(vi) m_STG_EMPLOYEES_xx

Step 2. Workflow Details

1) This section contains the workflow processing details:

a) Name the workflow wf_LOAD_ALL_STAGING_TABLES.

b) If you do not have the sessions named below in your folder, your instructor will show you how to copy them from the Solutions Folder.

c) No session can begin until an indicator file shows up. The indicator file will be named fileindxx.txt and will be created by you using an text editor. You will need to place this file in the directory indicated by the instructor after you start the workflow. If you are in a UNIX environment, you may need special permissions.

d) In order to utilize the CPUs in a more efficient manner, you will want to run some of the sessions concurrently and some of them sequentially:

(i) The session containing mappings s_STG_PAYMENT_xx, m_STG_PRODUCT_xx and m_STG_DEALERSHIP _xx can be run sequentially.

(ii) The session containing mapping m_STG_CUSTOMER_CONTACTS_xx can be run concurrently to the sessions in the previous bullet point.

e) If any of the previous session fails, then an email should be sent to the administrator and the workflow aborted.

f) The session containing mapping m_STG_EMPLOYEES_xx needs to be run after to the 4 previously mentioned sessions complete successfully.

g) The session containing mapping m_STG_TRANSACTIONS_xx can be run concurrently to the m_STG_EMPLOYEES_xx session.

h) If either of the previous sessions fail, an email should be sent to the administrator.

i) All session need to truncate the target tables.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates. 

Page 284: Informatica PowerCenter 9x Level One Developer Lab Guidedrukpoint.pl/integral/LG_PC9xL1D_201201v3_sm.wm.pdf ·  · 2013-12-10Informatica PowerCenter 9x Level One Developer Lab Guide

276 Lab 17 – wf_Load_All_Staging_Tables_xx PowerCenter 9x Level I Developer

j) The management only wants the workflow to run a maximum of 50 minutes. Should the workflow take longer, an email should be sent to the administrator. Should the workflow finish in the allotted time, the timer task will need to be stopped.

2) There is more than one solution to the workshop. You will know that your solution has worked when all of the sessions have completed successfully.

Un

Un

 

nauthorized

nauthorized

d reproductio

d reproductio

on or distrib

on or distrib

bution prohib

bution prohib

bited. Copyr

bited. Copyr

right© 2012

right© 2012

2, Informatic

2, Informatic

ca and/or its

ca and/or its

s affiliates. 

s affiliates.