Sei sulla pagina 1di 39

PowerCenter 8.

x Basics Case Study


07/01/2009

Pharma/ LSHC/ BI
Rajat Banerjee rajat.banerjee@tcs.com

TCS Public

PowerCenter 8.x Basics Case Study

Context
The purpose of this document is to understand the Basic transformations available in PowerCenter 8.x. These Transformations are vital to development of mappings which carry the information how to extract, transform and load data. This document covers following Transformations based on a running hands-on Case-Study conceiving the use of all these transformations. The Case-Study is divided in parts based on some underlying concept covering one or more transformations at one time. The target definitions developed in one mapping may be used as source definition in another mapping to continue the concept and complete the whole case-study. The Basic Transformations covered through this document are: FILTER TRANSFORMATION JOINER TRANSFORMATION SORTER TRANSFORMATION EXPRESSION TRANSFORMATION SOURCE QUALIFIER TRANSFORMATION AGGREGATOR TRANSFORMATION LOOKUP TRANSFORMATION

Background
Conceive a database build around the transactions at a chain of departmental stores. The typical activities at stores include maintaining customers information, maintaining employees information and the kind of job they perform, the items information available at the store along with promotion information, the sales and orders, procuring information with manufacturers and distributors. Thus the database has typically the following table structure: CUSTOMERS EMPLOYEES STORES MANUFACTURERS JOBS DEPARTMENT ITEMS PROMOTIONS ITEMS_IN_PROMOTIONS DISTRIBUTORS ORDERS ORDER_ITEMS

Internal use

PowerCenter 8.x Basics Case Study

Problem Statement
Consider that our objective here is to get the information of the amount of sales done by the chain of departmental stores. Herein we try to know the Total Cost of items sold for each Order (i.e. the amount of transactions done in each order) along with other Order details. The Order cost is the sum of all the items cost in the order with discount adjustments if any. The final target table should reflect the Total Cost against each Order_ID with other Order details. The intermediate target tables can be used as the source for subsequent mappings. Though in a real scenario, target may be much bigger and will have large number of tables and huge amounts of data in a very organized way to satisfy varied complex queries, we are here safely assuming our final target contains only one table with exactly necessary data to satisfy above query.

Analysis
Here our objective is to finally develop a target definition and store the required data in that target to satisfy the above query. For this we will identify the sources required to have the required data and then we pass the data from different source tables though various transformation logic finally loading the data in the target based on the target definition. We will design four mappings each having one or more transformation logic along with one target definition. 1. We start by identifying the necessary sources to provide the required data. These happen to be Items and Order_Items and Order tables in this particular case. 2. We start with Filter transformation wherein all the items which are discontinued are filtered out in the initial stage itself and subsequently joined with Order_Items using joiner transformation to get Quantity, Price and Discount details for each item. The data is loaded in a target table TARGET_ITEMS_ORDER. 3. With using the above target definition as source, the expression transformation is used to calculate the Item Cost for each item based on Quantity, Price and discount in the all the Orders. The data is loaded in the target table TARGET_ITEMS_ORDER1. 4. With this target definition as new source the data is sorted based on the Order_ID and passed to the Aggregator transformation as sorted input to be grouped by Order_ID. The aggregated sum of Item Costs is taken for each Order_ID. The data is loaded in the Target Table TARGET_ITEMS_ORDER2. 5. Finally using the above Target definition as source and using the Lookup transformation we obtain details (from ORDERS table) for each order based on ORDER_ID. We put these details along with the Order costs calculated in above four steps into the final target table TARGET_ORDER_COST.

Internal use

PowerCenter 8.x Basics Case Study

Solutions
CONFIGURATION PARAMETERS
The following configuration is assumed to be met before starting with this hands-on. We will use these parameter names throughout this case study. However, these parameters can be replaced with the actual parameters as and when applicable. Further its assumed that the required source tables have been created and loaded into source database by running the script. SOURCE DATABASE TYPE SOURCE DATABASE NAME PASSWORD TARGET DATABASE TYPE TARGET DATABASE NAME PASSWORD SOURCE ODBC USER DSN TARGET ODBC USER DSN SOURCE CONNECTION TARGET CONNECTION REPOSITORY NAME WORKING FOLDER NAME REPOSITORY USER : : : : : : : : : : : : : Oracle XXXXXX XXXXXX Oracle XXXXXX XXXXXX YYYYYY YYYYYY ZZZZZZZ ZZZZZZZ REP_XXXXXX <Specific for each user> USER1, USER2... USERX

Lab 1a - Adding a Repository mentioned in Admin Console


Open the Repository Manager. Go to Repository menu and click Add Repository.

Internal use

PowerCenter 8.x Basics Case Study

Enter the Repository Name and User Name Double click on the repository once it gets added in the Navigator window Enter the user name, password and the Domain Name. The Repository Manger opens the repository

Internal use

PowerCenter 8.x Basics Case Study

Lab 1b -Adding a user to Developer group


Open the Repository Manger. Connect to the repository by double clicking it. Enter the username and password with Administrator privileges. Go to Security menu and click Manage Users and Privileges. Create a new user by checking on the Add tab. The Repository Manager creates a new user. Click on the user name that you want to add and then select Edit. Choose the Group name Developer on Not Member of and click Add

Lab 1c-Creating a new folder


Open the Repository Manager and connect to the repository by double-clicking on it. Enter the User Name and Password and click connect. The Repository Manager connects to the repository. Go to Folder menu and click create. Enter the folder name and in Permissions table tick Read,Write,Execute for Owner, tick Read, Write for Owners Group and tick Read for Repository. Click OK. A new folder is inserted in the repository.

Internal use

PowerCenter 8.x Basics Case Study

Lab 2a Creation/Configuration of ODBC Connections


Open the designer and connect to the repository by double-clicking on it. Enter User Name, Password and domain name and click connect. The designer connects to the repository. Double Click on the folder created in the Repository Manager under the repository name. Go to Tools menu and click Source Analyzer. The source analyzer workspace opens up. It deals with importing and defining of source definitions. Go to sources menu and click Import from Database. This prompts you to import source definitions from a database. Click on the encircled button as shown in the figure below:

Internal use

PowerCenter 8.x Basics Case Study

Check for the DataDirect ODBC connection. If not present say add follow the following process

Internal use

PowerCenter 8.x Basics Case Study

Select the driver for Oracle and mention the configuration as per the details

Internal use

PowerCenter 8.x Basics Case Study Test the connection For the DataDirect ODBC connections already present choose the connection any say configure and test the connection Ensure the validity of the connections Make two ODBC connection one as TUTORIAL_SOURCE and other as TUTORIAL_TARGET. Use only DataDirect ODBC connectors and discard the native database driver ODBC connections if any by the above mention names

Lab 2b Importing of Source definitions


Open the designer and connect to the repository by double-clicking on it. Enter User Name, Password and domain name and click connect. The designer connects to the repository. Double Click on the folder created in the Repository Manager under the repository name. Go to Tools menu and click Source Analyzer. The source analyzer workspace opens up. It deals with importing and defining of source definitions. Go to sources menu and click Import from Database. This prompts you to import source definitions from a database. Select the ODBC data source. TUTORIAL_SOURCE in this particular case. Enter User Name, Owner Name and the password. Click Connect. All the default tables are shown in the Select Tables Window.

Select all and click OK.

Internal use

10

PowerCenter 8.x Basics Case Study All the folder. o o o o o o o o o o o o Twelve tables are shown under TUTORIAL_SOURCE source in the Sources CUSTOMERS EMPLOYEES STORES MANUFACTURERS JOBS DEPARTMENT ITEMS PROMOTIONS ITEMS_IN_PROMOTIONS DISTRIBUTORS ORDERS ORDER_ITEMS

You have successfully imported the source tables. Do Repository - save.

USING FILTER AND JOINER TRANSFORMATION Duration Source Definition Target Definition : : : 15 minutes ITEMS, ORDER_ITEMS TARGET_ITEMS_ORDER

So, now when we have imported the source tables we can start with our first transformation logic wherein we filter the Items data which are discontinued. Thus, our target table will have only current items. Create mapping Click Tools Menu and select Mapping Designer. From the Mapping menu select Create. Enter new Mapping name. Enter m_CaseStudy1. A new mapping with this name is created and will be shown in the Mappings folder of the Case Studies folder in the navigator window. Click OK. Click the sources folder and drag and drop ITEMS table to the mapping designer workspace. The source definition of the table ITEMS is shown in the workspace. The source definition is associated with the Source Qualifier Transformation which is used for qualifying the data to be extracted while running the mapping. We can even write SQL queries in SQ transformation to qualify the data to be extracted. Click the sources folder and drag and drop ORDER_ITEMS table to the mapping designer workspace. Do Repository Save.

Internal use

11

PowerCenter 8.x Basics Case Study Create Target Definition

Lab 2c Creation of Target definitions for mapping 1


From the tools menu select Target Designer . We will use ITEMS source definition from the sources to create the target definition. Drag and drop the items table on Target designer. Double click the Heading area of the definition. Edit window opens up. Rename the table as TARGET_ITEMS_ORDER. Click the ports Tab. Add three new ports to the existing ports. Name them, ORDER_ID, QUANTITY and DISCOUNT. Select number as datatype for all three. Select 38, 2 as Precision for ORDER_ID and QUANTITY and 10, 2 for DISCOUNT. Make ITEM_ID and ORDER_ID as primary key. Choose Targets Generate/Execute SQL from the menu. Connect to database using TUTORIAL_TARGET datasource and Target database Username and Password.

In Generate from choose Selected Tables and choose Create Table and Drop Table options with Primary and Foreign key. Enter the SQL filename and click Generate and Execute. The SQL script runs and the output are shown in the output window. The target table is created in the target database. Do Repository - Save.

Internal use

12

PowerCenter 8.x Basics Case Study Working with Transformations

Lab 3a - Create Filter Transformation mapping 1


Select Mapping Designer from the Tools menu and then create from the transformations Menu. Choose Transformation Type as Filter and name it as FIL_DisContFlag. Click create and done. Filter transformation is created in the workspace. Select all fields from the ITEMS source qualifier. Drag and drop the fields on the filter transformation. Choose menu-Layout-Link columns. The columns are automatically linked. Double click the heading part of the filter transform. The Edit Transformation window opens up. Click on the properties tab. . Expression Editor window opens up. In the In filter condition click on the arrow formula section equate DISCONTINUED_FLAG column equal to zero by double clicking the column in the ports tab.

Click on Validate and then OK. Click OK in edit transformation window. Click Transformations Create from the menu.

Lab 3b - Create Joiner Transformation mapping 1


Select Joiner type and enter JOIN_Items as the name of the transformation. Click create and done. Drag and drop all the fields from FIL_DisContFlag and then from SQ_ORDER_ITEMS to JOIN_Items. Double click the heading portion of JOIN_Items. Edit transformation window opens up. Select the condition ITEM_ID1 = ITEM_ID.

Internal use

13

PowerCenter 8.x Basics Case Study

Click Ports tab and clear off ITEM_ID1 output port column. We are not going to put the redundant data into the target table. Click OK.

Completing the mapping Click the mappings folder in the Case-Studies folder and TARGET_ITEMS_ORDER in the mapping from target instances. drag the target

Internal use

14

PowerCenter 8.x Basics Case Study Connect all the fields of joiner transformation other than ITEM_ID1 with the corresponding ones of target definition. The final mapping should look like this:

ITEMS (Oracle)

SQ_ITEMS

FIL_DisContFlag

ORDER_ITEMS (Oracle)

SQ_ORDER_IT EMS

JOIN_items

Do Repository Save.

TARGET_ITEM S_ORDER (Ora cle)

Lab 4a Check/Assign the Integration Service to a Repository


Open the admin console web page Login and click on the respective Integration Service Check the Associated Repository tab and verify if the correct repository is assigned or not.

Internal use

15

PowerCenter 8.x Basics Case Study

Lab 4b - Set up Relational Connection for Source & Target database


Open the Workflow designer from the Informatica clients and connect to the repository. All the folders are shown in the navigator window with associated tasks, sessions and workflow if any. Choose Connection Relational

Choose New

Internal use

16

PowerCenter 8.x Basics Case Study

Choose the subtype to be Oracle Create two relational connection by the names SERVER_SOURCE_CONN SERVER_TARGET_CONN and mention the required fields for them.

and

Internal use

17

PowerCenter 8.x Basics Case Study

Lab 4c - Create session for Mapping 1


Creating Session, Workflow and Running the Workflow Herein we develop create a session task and the workflow to run the mapping and load the data into the target. Open the Workflow designer from the Informatica clients and connect to the repository. All the folders are shown in the navigator window with associated tasks, sessions and workflow if any. Select Task Developer from tools menu. Click Tasks create from the tasks menu. Choose session as task type and name it s_CaseStudy1. Click create. In mappings choose m_CaseStudy1. Click Ok. Click done. Session with mapping m_CaseStudy1 is created. Now we have to set the connections of the Informatica server of each source and target definitions in the mapping to the corresponding databases for extracting and loading the data while running the workflow. We will create Relational Connection for Source and target (if it is not created) In the Workflow Manager, select Connections and choose Relational Select the type to be Oracle and click Add (If SERVER_SOURCE_CONN in not there) and enter the properties. Select the type to be Oracle and click Add (If SERVER_TARGET_CONN in not there) and enter the properties.

Internal use

18

PowerCenter 8.x Basics Case Study

Double click the session task s_CaseStudy1. Edit task window opens up. Click the mapping tab. in the connections type. In the sources in select SQ_ITEMS. Then click the Relational Connection Browser window opens up. Select Server_Source_Conn. Click OK. Repeat the same for SQ_ORDER_ITEMS. For target TARGET_ITEMS_ORDER select SERVER_TARGET_CONN as connection type. In the target Attributes select Normal as the target load type and Truncate Table Option for truncating the table prior to any loading. Click Apply and then OK.

Lab 4d - Create Workflow for Mapping 1


Choose tools workflow designer from the menu. Click workflow create from the menu. Name the workflow w_CaseStudy1. Click Ok. A workflow is created with the Start task as the default. From the Navigator window drag and drop the s_CaseStudy1 task from session folder in the Case Studies folder.

Internal use

19

PowerCenter 8.x Basics Case Study

Choose tasks link task from the menu. Connect the tasks with the link. Do Repository Save.

Lab 4e Assigning Workflow to the Integration Service


Close all the folders in the Workflow Manager Select Servics and Assign Integration Service Select the Integration Service and the respective folder Check the workflow and click Assign

Internal use

20

PowerCenter 8.x Basics Case Study

Lab 4f - Execute Workflow for Mapping 1


Workflow Monitor Open the Workflow Monitor and connect to the Informatica server. From the Workflow Manager choose Workflows Start Workflow from the menu. The Workflow monitor shows the running and status of the session and the workflow in Gantt chart and task view mode.

Internal use

21

PowerCenter 8.x Basics Case Study

Lab 4g - View Session Log


See for the successful completion of session and the workflow. 64 entries are loaded on successful completion.

Lab 4h - Creating a debug session for mapping 1


Go the Designer Window Go in Tools -> Options Debug Set the port no in the Debug tab to be 6010

Internal use

22

PowerCenter 8.x Basics Case Study

Open the mapping m_CaseStudy1 and go in Mappings Debugger Start Debugger It asks for the Integration Service , mention the one to whom we assigned the workflow to. For other options select the default options.

The value for the source fields can be seen against them in the Output Window

The value for the target fields can be seen against them in the Output Window

Internal use

23

PowerCenter 8.x Basics Case Study USING EXPRESSION TRANSFORMATION Duration Source Definition Target Definition : : : 15 minutes TARGET_ITEMS_ORDER TARGET_ITEMS_ORDER1

Having completed the first two steps of our Solution Roadmap, we move on to the third step wherein we using the above target definition as source, use the expression transformation to calculate the Item Cost for each item based on Quantity, Price and discount in all the Orders. The data is loaded in the target table by running the workflow. Importing Sources Open the Designer from the clients and connect to the repository if not already connected. Double Click on the Case Studies folder under the repository name. Go to Tools menu and click Source Analyzer. The source analyzer workspace opens up. Go to sources menu and click Import from Database. This prompts you to import source definitions from a database. Select the ODBC data source. TUTORIAL_TARGET in this particular case, since we plan to import the definition already created as target in target database. Enter User Name of the Target Database, Owner Name and the password of the Target Database. Click Connect. All the default tables are shown in the Select Tables Window. Select TARGET_ITEMS_ORDER and click OK. The tables is shown under TUTORIAL_TARGET source in the Sources folder. You have successfully imported the source table.

Create mapping Click Tools Menu and select Mapping Designer. From the Mapping menu select Create. Enter new Mapping name. Enter m_CaseStudy2. A new mapping with this name is created and will be shown in the Mappings folder of the Case Studies folder in the navigator window. Click Ok. Click the sources folder and drag and drop TARGET_ITEMS_ORDER table definition under TUTORIAL_TARGET data source to the mapping designer workspace. Here we are using the target as the source.

Internal use

24

PowerCenter 8.x Basics Case Study

The source definition of the table TARGET_ITEMS_ORDER is shown in the workspace. Do Repository Save.

Create Target Definition From the tools menu select Target Designer. We will use TARGET_ITEMS_ORDER definition from the sources to create the target definition. Drag and drop the TARGET_ITEMS_ORDER table on Target designer. Double click the Heading area of the definition. Edit window opens up. Rename the table as TARGET_ITEMS_ORDER1. Click the ports Tab. Remove the fields PRICE, QUANTITY, DISCOUNT and add a new field ITEM_COST. This field will store the cost of each item listed in the order. Select Datatype as number and precision as (38, 2). Make ITEM_ID and ORDER_ID as primary key. Click OK. Choose Targets Generate/Execute SQL from the menu. Connect to database using TUTORIAL_TARGET datasource and Target database Username and Password. In Generate from choose Selected Tables and choose Create Table and Drop Table options with Primary and Foreign key. Enter the SQL filename and click Generate and Execute. The SQL script runs and the output are shown in the output window. The target table is created in the target database. Do Repository - Save.

Lab 2c Expression Transformation for Case Study 2


Working with Expression Transformation Select Mapping Designer from the Tools menu and then create from the transformations Menu. Choose Transformation Type as Expression and name it as EXP_TotalQty. Click create and done. Expression transformation is created in the workspace. Select all fields from the TARGET_ITEMS_ORDER source qualifier. Drag and drop the fields on the Expression transformation. Choose menu-Layout-Link columns. The columns are automatically linked. Double click the heading part of the EXP_TotalQty. The Edit Transformations window opens up. Click on the ports tab. Add a new port ITEM_COST with decimal datatype and precision (38, 2). Make it as only output port. Check off Input port box. Check off Output ports for PRICE, QUANTITY and DISCOUNT fields. Make them input ports.

Internal use

25

PowerCenter 8.x Basics Case Study

In the Expression column for the ITEM_COST click . The Expression editor opens up. Enter the expression QUANTITY * PRICE - (QUANTITY * PRICE * DISCOUNT / 100) in the formula window using ports tab and double clicking on the columns in it.

Click Validate and then OK. Click OK in edit transformation window.

Completing the mapping Click the mappings folder in the Case-Studies folder and drag the target TARGET_ITEMS_ORDER1 in the mapping from target instances. Connect all the fields of the transformation other than PRICE, QUANTITY and DISCOUNT with the corresponding ones of target definition. The final mapping should look like this:

Internal use

26

PowerCenter 8.x Basics Case Study

Do Repository Save.

Running the Workflow Herein we develop create a session task and the workflow to run the mapping and load the data into the target TARGET_ITEMS_ORDER1. Open the Workflow designer from the Informatica clients and connect to the repository. Select Task Developer from tools menu. Click Tasks create from the tasks menu. Choose session as task type and name it s_CaseStudy2. Click create. In mappings choose m_CaseStudy2. Click Ok. Click done. Session with mapping m_CaseStudy2 is created. Now we have to set the connections of the Informatica server of each source and target definitions in the mapping to the corresponding databases for extracting and loading the data while running the workflow. Double click the session task s_CaseStudy2. Edit task window opens up. Click the mapping tab.

Internal use

27

PowerCenter 8.x Basics Case Study In the sources select SQ_TARGET_ITEMS_ORDER. Then click the in the connections type. Relational Connection Browser window opens up. Select SERVER_TARGET_Conn. Click OK. For taPowerCenter 8.x Basics Case Studyrget TARGET_ITEMS_ORDER1 select SERVER_TARGET_CONN as connection type. In the target Attributes select Normal as the target load type and Truncate Table Option for truncating the table prior to any loading. Click Apply and then OK. Choose tools workflow designer from the menu. Click workflow create from the menu. Name the workflow w_CaseStudy2. Click Ok. A workflow is created with the Start task as the default. From the Navigator window drag and drop the s_CaseStudy2 task from session folder in the Case Studies folder.

Choose tasks link task from the menu. Connect the tasks with the link. Do Repository Save.

Workflow Monitor Open the Workflow Monitor and connect to the Informatica server. From the workflow monitor choose Workflows Start Workflow from the menu. The Workflow monitor shows the running and status of the session and the workflow in Gantt chart and task view mode. See for the successful completion of session and the workflow.

USING SORTER AND AGGREGATOR TRANSFORMATION Duration Source Definition Target Definition : : : 15 minutes TARGET_ITEMS_ORDER1 TARGET_ITEMS_ORDER2

Internal use

28

PowerCenter 8.x Basics Case Study

Having completed the first three steps of our Solution Roadmap, we move on to the last step wherein we using the above target definition as source, use the sorter and aggregator to calculate the TOTAL_ORDER_COST for each Order by taking the aggregated sum of ITEM_COST grouped by ORDER_ID. The data is loaded in the target table by running the workflow. Importing Sources Open the Designer from the clients and connect to the repository if not already connected. Double Click on the Case Studies folder under the repository name. Go to Tools menu and click Source Analyzer. The source analyzer workspace opens up. Go to sources menu and click Import from Database. This prompts you to import source definitions from a database. Select the ODBC data source. TUTORIAL_TARGET in this particular case, since we plan to import the definition already created as target in target database. Enter User Name of the Target Database, Owner Name and the password of the Target Database. Click Connect. All the tables are shown in the Select Tables Window. Select TARGET_ITEMS_ORDER1 and click OK. The tables is shown under TUTORIAL_TARGET source in the Sources folder. You have successfully imported the source table.

Create mapping Click Tools Menu and select Mapping Designer. From the Mapping menu select Create. Enter new Mapping name. Enter m_CaseStudy3. A new mapping with this name is created and will be shown in the Mappings folder of the Case Studies folder in the navigator window. Click Ok. Click the sources folder and drag and drop TARGET_ITEMS_ORDER1 table definition under TUTORIAL_TARGET data source to the mapping designer workspace. Here we are using the target as the source.

Internal use

29

PowerCenter 8.x Basics Case Study

The source definition of the table TARGET_ITEMS_ORDER1 is shown in the workspace. Do Repository Save.

Create Target Definition From the tools menu select Target designer. We will use TARGET_ITEMS_ORDER1 definition from the sources to create the target definition. Drag and drop the TARGET_ITEMS_ORDER1 table on Target designer. Double click the Heading area of the definition. Edit window opens up. Rename the table as TARGET_ITEMS_ORDER2. Click the ports Tab. Remove the field ITEM_COST and add a new field TOTAL_ORDER_COST. This field will store the total cost by order. Select Datatype as number and precision as (38, 2). Make ORDER_ID as primary key. Click OK. Choose Targets Generate/Execute SQL from the menu. Connect to database using TUTORIAL_TARGET datasource and Target database Username and Password. In Generate from choose Selected Tables and choose Create Table and Drop Table options with Primary and Foreign key. Enter the SQL filename and click Generate and Execute. The SQL script runs and the output are shown in the output window. The target table is created in the target database. Do Repository - Save.

Working with SORTER and AGGREGATOR Transformation

Lab 5a - Create Sorter Tranformation for mapping 3


Select Mapping Designer from the Tools menu and then create from the transformations Menu. Choose Transformation Type as Sorter and name it as SOR_OrderID. Click create and done. Sorter transformation is created in the workspace. Select all fields from the TARGET_ITEMS_ORDER1 source qualifier. Drag and drop the fields on the Sorter transformation. Choose menu-Layout-Link columns. The columns are automatically linked.

Internal use

30

PowerCenter 8.x Basics Case Study

Double click the heading part of the SOR_OrderID. The Edit Transformations window opens up. Click on the ports tab. Select the Key box of ORDER_ID field. The rows are sorted based on ORDER_ID. Default sorting is in ascending order. Click Ok. Choose create from Transformation menu.

Lab 5b - Create Aggregator Tranformation for mapping 3


Choose transformation Type as Aggregator. Name it as AGG_OrderID and click create then done. Aggregator transformation is created on the workspace. Select all fields from the SOR_OrderID Transformation. Drag and drop the fields on the AGG_OrderID transformation. The fields will automatically link. Double click the heading part of the AGG_OrderID. The Edit Transformations window opens up. Click on the ports tab. Add a new column o_TOTAL_ORDER_COST with datatype decimal and precision (38, 2). Check off the input port box and make it output port. Check off the output port for ITEM_COST and make it input port. Rename the port as in_ITEM_COST Select Group By for the ORDER_ID field. Invoke expression editor for o_TOTAL_ORDER_COST and add a function to sum all the costs. SUM(in_ITEM_COST). Validate and save changes. Click properties tab. Select the Sorted input box. We are providing the sorted input to the transform, sorted on ORDER_ID. Click OK.

Completing the mapping Click the mappings folder in the Case-Studies folder and drag the target TARGET_ITEMS_ORDER2 in the mapping from target instances. Connect the Fields of SOR_OrderID and AGG_OrderID. Connect also the fields of AGG_OrderID and TARGET_ITEMS_ORDER2 as shown in the mapping below:

Internal use

31

PowerCenter 8.x Basics Case Study

Do Repository Save.

Running the Workflow Herein we develop create a session task and the workflow to run the mapping and load the data into the target TARGET_ITEMS_ORDER2. Open the Workflow designer from the Informatica clients and connect to the repository. Select Task Developer from tools menu. Click Tasks create from the tasks menu. Choose session as task type and name it s_CaseStudy3. Click create. In mappings choose m_CaseStudy3. Click Ok. Click done. Session with mapping m_CaseStudy3 is created. Now we have to set the connections of the Informatica server of each source and target definitions in the mapping to the corresponding databases for extracting and loading the data while running the workflow. Double click the session task s_CaseStudy3. Edit task window opens up. Click the mapping tab.

In the sources select SQ_TARGET_ITEMS_ORDER1. Then click the connections type. Relational Connection Browser window opens up. Select SERVER_TARGET_Conn. Click OK.

in the

Internal use

32

PowerCenter 8.x Basics Case Study For target TARGET_ITEMS_ORDER2 select SERVER_TARGET_CONN as connection type. In the target Attributes select Normal as the target load type and Truncate Table Option for truncating the table prior to any loading. Click Apply and then OK. Choose tools workflow designer from the menu. Click workflow create from the menu. Name the workflow w_CaseStudy3. Click Ok. A workflow is created with the Start task as the default. From the Navigator window drag and drop the s_CaseStudy3 task from session folder in the Case Studies folder.

Choose tasks link task from the menu. Connect the tasks with the link. Do Repository Save.

Workflow Monitor Open the Workflow Monitor and connect to the Informatica server. From the workflow monitor choose Workflows Start Workflow from the menu. The Workflow monitor shows the running and status of the session and the workflow in Gantt chart and task view mode. See for the successful completion of session and the workflow. The required final data is loaded into the TARGET_ITEMS_ORDER.

USING LOOKUP TRANSFORMATION Duration Source Definition Target Definition : : : 15 minutes TARGET_ITEMS_ORDER2 TARGET_ORDERS_COST

Having completed the first three steps of our Solution Roadmap, we move on to the last step wherein we using the above target definition as source, use the sorter and aggregator to

Internal use

33

PowerCenter 8.x Basics Case Study calculate the TOTAL_ORDER_COST for each Order by taking the aggregated sum of ITEM_COST grouped by ORDER_ID. The data is loaded in the target table by running the workflow. Importing Sources Open the Designer from the clients and connect to the repository if not already connected. Double Click on the Case Studies folder under the repository name. Go to Tools menu and click Source Analyzer. The source analyzer workspace opens up. Go to sources menu and click Import from Database. This prompts you to import source definitions from a database. Select the ODBC data source. TUTORIAL_TARGET in this particular case, since we plan to import the definition already created as target in target database. Enter User Name of the Target Database, Owner Name and the password of the Target Database. Click Connect. All the tables are shown in the Select Tables Window. Select TARGET_ITEMS_ORDER2 and click OK. The table is shown under TUTORIAL_TARGET source in the Sources folder. You have successfully imported the source table.

Create mapping Click Tools Menu and select Mapping Designer. From the Mapping menu select Create. Enter new Mapping name. Enter m_CaseStudy4. A new mapping with this name is created and will be shown in the Mappings folder of the Case Studies folder in the navigator window. Click Ok. Click the sources folder and drag and drop TARGET_ITEMS_ORDER2 table definition under TUTORIAL_TARGET data source to the mapping designer workspace. Here we are using the target as the source.

The source definition of the table TARGET_ITEMS_ORDER2 is shown in the workspace. Do Repository Save.

Internal use

34

PowerCenter 8.x Basics Case Study Create Target Definition From the tools menu select Target designer. We will use ORDERS definition from the sources to create the target definition. Drag and drop the ORDERS table on Target designer. Double click the Heading area of the definition. Edit window opens up. Rename the table as TARGET_ORDERS_COST. Click the ports Tab. Add field TOTAL_ORDER_COST to the existing fields. Select Datatype as number and precision as (38, 2). Make ORDER_ID as primary key. Click OK. Choose Targets Generate/Execute SQL from the menu. Connect to database using TUTORIAL_TARGET datasource and Target database Username and Password. In Generate from choose Selected Tables and choose Create Table and Drop Table options with Primary and Foreign key. Enter the SQL filename and click Generate and Execute. The SQL script runs and the output are shown in the output window. The target table is created in the target database. Do Repository - Save.

Lab 6 - Develop/execute mapping, session and workflow for mapping 4 working with Lookup Transformation
Select Mapping Designer from the Tools menu and then create from the transformations Menu. Choose Transformation Type as Lookup and name it as LKP_OrderID. Click create. In the select lookup table box select source as the location. All source tables are shown. Click ORDERS and then click Ok. Click done. Lookup transformation is created.

Choose menu-Layout-Link columns. The columns are automatically linked. All fields from the ORDERS table automatically list in the transformation. The transformation looks up ORDERS for the matching ORDER_ID coming from Source.

Internal use

35

PowerCenter 8.x Basics Case Study

Double click the heading part of the LKP_OrderID. The Edit Transformations window opens up. Click on the ports tab. Add a new field IN_ORDER_ID with datatype and precision same as ORDER_ID. Make it Input-Output port. Make ORDER_ID lookup port. As shown in figure. Click Condition tab. Add a new condition as shown. ORDER_ID = IN_ORDER_ID.

Click OK. The Lookup transformation is configured.

Internal use

36

PowerCenter 8.x Basics Case Study

Completing the mapping Click the mappings folder in the Case-Studies folder and drag the target TARGET_ORDERS_COST in the mapping from target instances. Connect the corresponding Fields of SQ_ORDERS and LKP_OrderID and TARGET_ORDERS_COST as shown in the mapping below:

Do Repository Save.

Running the Workflow Herein we develop create a session task and the workflow to run the mapping and load the data into the target TARGET_ORDERS_COST. Open the Workflow designer from the Informatica clients and connect to the repository. Select Task Developer from tools menu. Click Tasks create from the tasks menu. Choose session as task type and name it s_CaseStudy4. Click create. In mappings choose m_CaseStudy4. Click Ok. Click done. Session with mapping m_CaseStudy4 is created. Now we have to set the connections of the Informatica server of each source, target definitions and Lookup in the mapping to the corresponding databases for extracting, loading and Lookup the data while running the workflow. Double click the session task s_CaseStudy4. Edit task window opens up. Click the mapping tab.

Internal use

37

PowerCenter 8.x Basics Case Study

In the sources select SQ_TARGET_ITEMS_ORDER2. Then click the in the connections type. Relational Connection Browser window opens up. Select SERVER_TARGET_Conn. Click OK. For target TARGET_ORDERS_COST select SERVER_TARGET_CONN as connection type. In the target Attributes select Normal as the target load type and Truncate Table Option for truncating the table prior to any loading. In Transformations select LKP_OrderID and choose SERVER_SOURCE_CONN as lookup source. Click Apply and then OK. Choose tools workflow designer from the menu. Click workflow create from the menu. Name the workflow w_CaseStudy4. Click Ok. A workflow is created with the Start task as the default. From the Navigator window drag and drop the s_CaseStudy4 task from session folder in the Case Studies folder.

Internal use

38

PowerCenter 8.x Basics Case Study

Choose tasks link task from the menu. Connect the tasks with the link. Do Repository Save. Workflow Monitor

Open the Workflow Monitor and connect to the Informatica server. From the workflow monitor choose Workflows Start Workflow from the menu. The Workflow monitor shows the running and status of the session and the workflow in Gantt chart and task view mode. See for the successful completion of session and the workflow. The required final data is loaded into the TARGET_ORDERS_COST. Total 24 rows are loaded.

Internal use

39