Upload
kukunurib
View
217
Download
0
Embed Size (px)
Citation preview
8/6/2019 a Power Center 8x Hands Onp.unlocked
1/39
Pow erCenter 8.x Basics Case Study07/01/2009
Pharma/ LSHC/ BI
Rajat Banerjee
TCS Public
8/6/2019 a Power Center 8x Hands Onp.unlocked
2/39
PowerCenter 8.x Basics Case Study
Internal use 2
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 theinformation 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 thesetransformations. The Case-Study is divided in parts based on some underlying concept coveringone or more transformations at one time. The target definitions developed in one mapping maybe 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 typicalactivities at stores include maintaining customers information, maintaining employeesinformation and the kind of job they perform, the items information available at the store alongwith promotion information, the sales and orders, procuring information with manufacturers anddistributors.
Thus the database has typically the following table structure:
CUSTOMERS EMPLOYEES STORES MANUFACTURERS JOBS DEPARTMENT ITEMS PROMOTIONS ITEMS_IN_PROMOTIONS DISTRIBUTORS ORDERS ORDER_ITEMS
8/6/2019 a Power Center 8x Hands Onp.unlocked
3/39
PowerCenter 8.x Basics Case Study
Internal use 3
Problem StatementConsider that our objective here is to get the information of the amount of sales done by thechain 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 Ordercost 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. Theintermediate 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 andhuge 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 satisfyabove query.
Analysis
Here our objective is to finally develop a target definition and store the required data in thattarget 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 varioustransformation 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 onetarget definition.
1. We start by identifying the necessary sources to provide the required data. Thesehappen 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 arefiltered out in the initial stage itself and subsequently joined with Order_Items usingjoiner transformation to get Quantity, Price and Discount details for each item. The datais loaded in a target table TARGET_ITEMS_ORDER.
3. With using the above target definition as source, the expression transformation is used tocalculate the Item Cost for each item based on Quantity, Price and discount in the all theOrders. 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 andpassed to the Aggregator transformation as sorted input to be grouped by Order_ID. Theaggregated sum of Item Costs is taken for each Order_ID. The data is loaded in theTarget Table TARGET_ITEMS_ORDER2.
5. Finally using the above Target definition as source and using the Lookup transformationwe obtain details (from ORDERS table) for each order based on ORDER_ID. We putthese details along with the Order costs calculated in above four steps into the finaltarget table TARGET_ORDER_COST.
8/6/2019 a Power Center 8x Hands Onp.unlocked
4/39
PowerCenter 8.x Basics Case Study
Internal use 4
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 replacedwith the actual parameters as and when applicable. Further its assumed that the required sourcetables have been created and loaded into source database by running the script.
SOURCE DATABASE TYPE : OracleSOURCE DATABASE NAME : XXXXXXPASSWORD : XXXXXXTARGET DATABASE TYPE : OracleTARGET DATABASE NAME : XXXXXXPASSWORD : XXXXXX
SOURCE ODBC USER DSN : YYYYYYTARGET ODBC USER DSN : YYYYYY
SOURCE CONNECTION : ZZZZZZZTARGET CONNECTION : ZZZZZZZ
REPOSITORY NAME : REP_XXXXXXWORKING FOLDER NAME : REPOSITORY 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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
5/39
PowerCenter 8.x Basics Case Study
Internal use 5
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
8/6/2019 a Power Center 8x Hands Onp.unlocked
6/39
PowerCenter 8.x Basics Case Study
Internal use 6
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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
7/39
PowerCenter 8.x Basics Case Study
Internal use 7
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:
8/6/2019 a Power Center 8x Hands Onp.unlocked
8/39
PowerCenter 8.x Basics Case Study
Internal use 8
Check for the DataDirect ODBC connection. If not present say add follow the followingprocess
8/6/2019 a Power Center 8x Hands Onp.unlocked
9/39
PowerCenter 8.x Basics Case Study
Internal use 9
Select the driver for Oracle and mention the configuration as per the details
8/6/2019 a Power Center 8x Hands Onp.unlocked
10/39
PowerCenter 8.x Basics Case Study
Internal use 10
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 ODBCconnections 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 sourcedefinitions 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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
11/39
PowerCenter 8.x Basics Case Study
Internal use 11
All the Twelve tables are shown under TUTORIAL_SOURCE source in the Sourcesfolder.
o CUSTOMERSo EMPLOYEESo STORESo MANUFACTURERSo JOBSo DEPARTMENTo ITEMSo PROMOTIONSo ITEMS_IN_PROMOTIONSo DISTRIBUTORSo ORDERSo ORDER_ITEMS
You have successfully imported the source tables. Do Repository - save.
USING FILTER AND JOINER TRANSFORMA TION
Duration : 15 minutesSource Definition : ITEMS, ORDER_ ITEMSTarget Definition : TARGET_ITEMS_ORDER
So, now when we have imported the source tables we can start with our first transformation logicwherein we filter the Items data which are discontinued. Thus, our target table will have onlycurrent 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 thenavigator window. Click OK.
Click the sources folder and drag and drop ITEMS table to the mapping designerworkspace.
The source definition of the table ITEMS is shown in the workspace. The sourcedefinition is associated with the Source Qualifier Transformation which is used forqualifying the data to be extracted while running the mapping. We can even write SQLqueries in SQ transformation to qualify the data to be extracted.
Click the sources folder and drag and drop ORDER_ITEMS table to the mappingdesigner workspace.
Do Repository Save.
8/6/2019 a Power Center 8x Hands Onp.unlocked
12/39
PowerCenter 8.x Basics Case Study
Internal use 12
Create Target DefinitionLab 2c Creation of Target definitions for mapping 1
From the tools menu select Target Designer . We will use ITEMS source definition fromthe 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 forORDER_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 Tableoptions with Primary and Foreign key.
Enter the SQL filename and click Generate and Execute. The SQL script runs and theoutput are shown in the output window. The target table is created in the targetdatabase.
Do Repository - Save.
8/6/2019 a Power Center 8x Hands Onp.unlocked
13/39
PowerCenter 8.x Basics Case Study
Internal use 13
Working w ith TransformationsLab 3a - Create Filter Transformation mapping 1
Select Mapping Designer from the Tools menu and then create from the transformationsMenu.
Choose Transformation Type as Filter and name it as FIL_DisContFlag. Click create anddone. Filter transformation is created in the workspace.
Select all fields from the ITEMS source qualifier. Drag and drop the fields on the filtertransformation.
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.
In filter condition click on the arrow . Expression Editor window opens up. In theformula section equate DISCONTINUED_FLAG column equal to zero by double clickingthe 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 m apping 1
Select Joiner type and enter JOIN_Items as the name of the transformation. Click createand done.
Drag and drop all the fields from FIL_DisContFlag and then from SQ_ORDER_ITEMS toJOIN_Items.
Double click the heading portion of JOIN_Items. Edit transformation window opens up.Select the condition ITEM_ID1 = ITEM_ID.
8/6/2019 a Power Center 8x Hands Onp.unlocked
14/39
PowerCenter 8.x Basics Case Study
Internal use 14
Click Ports tab and clear off ITEM_ID1 output port column. We are not going to put theredundant data into the target table.
Click OK.Completing the mapping
Click the mappings folder in the Case-Studies folder and drag the targetTARGET_ITEMS_ORDER in the mapping from target instances.
8/6/2019 a Power Center 8x Hands Onp.unlocked
15/39
PowerCenter 8.x Basics Case Study
Internal use 15
Connect all the fields of joiner transformation other than ITEM_ID1 with thecorresponding ones of target definition. The final mapping should look like this:
SQ_ORDER_IT
EMS
ORDER_ITEMS
(Oracle)
SQ_ITEMSITEMS(Oracle)
JOIN_items
FIL_DisContFlag
TARGET_ITEM
S_ORDER(Oracle)
Do Repository Save.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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
16/39
PowerCenter 8.x Basics Case Study
Internal use 16
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 andworkflow if any.
Choose Connection Relational
Choose New
8/6/2019 a Power Center 8x Hands Onp.unlocked
17/39
PowerCenter 8.x Basics Case Study
Internal use 17
Choose the subtype to be Oracle Create two relational connection by the names SERVER_SOURCE_CONN and
SERVER_TARGET_CONN and mention the required fields for them.
8/6/2019 a Power Center 8x Hands Onp.unlocked
18/39
PowerCenter 8.x Basics Case Study
Internal use 18
Lab 4c - Create session for Mapping 1
Creating Session, Workflow and R unning the W orkflow
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 andworkflow 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 thedata 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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
19/39
PowerCenter 8.x Basics Case Study
Internal use 19
Double click the session task s_CaseStudy1. Edit task window opens up. Click the mapping tab. In the sources in select SQ_ITEMS. Then click the in the connections type.
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 Work flow 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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
20/39
PowerCenter 8.x Basics Case Study
Internal use 20
Choose tasks link task from the menu. Connect the tasks with the link. Do Repository Save.
Lab 4e Assigning Work flow 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
8/6/2019 a Power Center 8x Hands Onp.unlocked
21/39
PowerCenter 8.x Basics Case Study
Internal use 21
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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
22/39
PowerCenter 8.x Basics Case Study
Internal use 22
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
8/6/2019 a Power Center 8x Hands Onp.unlocked
23/39
PowerCenter 8.x Basics Case Study
Internal use 23
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
8/6/2019 a Power Center 8x Hands Onp.unlocked
24/39
PowerCenter 8.x Basics Case Study
Internal use 24
USING EXPRESSION TRANSFORMATION Duration : 15 minutesSource Definition : TARGET_ITEMS_ORDERTarget Definition : TARGET_ITEMS_ORDER1
Having completed the f irst tw osteps of our Solution Roadmap, we move on to the thirdstep wherein we using the above target definition as source, use the expressiontransformation to calculate the Item Cost for each item based on Quantity, Price and discountin 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 alreadyconnected.
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 weare using the target as the source.
8/6/2019 a Power Center 8x Hands Onp.unlocked
25/39
PowerCenter 8.x Basics Case Study
Internal use 25
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_ORDERdefinition 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. Thisfield 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 targetdatabase.
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 transformationsMenu.
Choose Transformation Type as Expression and name it as EXP_TotalQty. Click createand done. Expression transformation is created in the workspace.
Select all fields from the TARGET_ITEMS_ORDER source qualifier. Drag and drop thefields 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 windowopens up. Click on the ports tab.
Add a new port ITEM_COST with decimal datatype and precision (38, 2). Make it as onlyoutput port. Check off Input port box.
Check off Output ports for PRICE, QUANTITY and DISCOUNT fields. Make them inputports.
8/6/2019 a Power Center 8x Hands Onp.unlocked
26/39
PowerCenter 8.x Basics Case Study
Internal use 26
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 targetTARGET_ITEMS_ORDER1 in the mapping from target instances.
Connect all the fields of the transformation other than PRICE, QUANTITY and DISCOUNTwith the corresponding ones of target definition. The final mapping should look like this:
8/6/2019 a Power Center 8x Hands Onp.unlocked
27/39
PowerCenter 8.x Basics Case Study
Internal use 27
Do Repository Save.Running the Workflow
Herein we develop create a session task and the workflow to run the mapping and load the datainto 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 thedata while running the workflow.
Double click the session task s_CaseStudy2. Edit task window opens up. Click the mapping tab.
8/6/2019 a Power Center 8x Hands Onp.unlocked
28/39
PowerCenter 8.x Basics Case Study
Internal use 28
In the sources select SQ_TARGET_ITEMS_ORDER. Then click the in the connectionstype. 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 TRANSFORMA TION
Duration : 15 minutesSource Definition : TARGET_ITEMS_ORDER1Target Definition : TARGET_ITEMS_ORDER2
8/6/2019 a Power Center 8x Hands Onp.unlocked
29/39
PowerCenter 8.x Basics Case Study
Internal use 29
Having completed the first threesteps of our Solution Roadmap, we move on to the laststep 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 sumof ITEM_COSTgrouped byORDER_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 alreadyconnected.
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 TargetDatabase. 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 thenavigator window. Click Ok.
Click the sources folder and drag and drop TARGET_ITEMS_ORDER1 table definitionunder TUTORIAL_TARGET data source to the mapping designer workspace. Here weare using the target as the source.
8/6/2019 a Power Center 8x Hands Onp.unlocked
30/39
PowerCenter 8.x Basics Case Study
Internal use 30
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_ORDER1definition 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 willstore 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 targetdatabase.
Do Repository - Save.Working w ith SORTER and AGGREGATOR Transformation
Lab 5a - Create Sorter Tranformation for m apping 3
Select Mapping Designer from the Tools menu and then create from the transformationsMenu.
Choose Transformation Type as Sorter and name it as SOR_OrderID. Click create anddone. Sorter transformation is created in the workspace.
Select all fields from the TARGET_ITEMS_ORDER1 source qualifier. Drag and drop thefields on the Sorter transformation.
Choose menu-Layout-Link columns. The columns are automatically linked.
8/6/2019 a Power Center 8x Hands Onp.unlocked
31/39
PowerCenter 8.x Basics Case Study
Internal use 31
Double click the heading part of the SOR_OrderID. The Edit Transformations windowopens up. Click on the ports tab.
Select the Key box of ORDER_ID field. The rows are sorted based on ORDER_ID. Defaultsorting 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 createthen done. Aggregator transformation is created on the workspace.
Select all fields from the SOR_OrderID Transformation. Drag and drop the fields on theAGG_OrderID transformation. The fields will automatically link.
Double click the heading part of the AGG_OrderID. The Edit Transformations windowopens 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 targetTARGET_ITEMS_ORDER2 in the mapping from target instances.
Connect the Fields of SOR_OrderID and AGG_OrderID. Connect also the fields ofAGG_OrderID and TARGET_ITEMS_ORDER2 as shown in the mapping below:
8/6/2019 a Power Center 8x Hands Onp.unlocked
32/39
PowerCenter 8.x Basics Case Study
Internal use 32
Do Repository Save.Running the Workflow
Herein we develop create a session task and the workflow to run the mapping and load the datainto 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 thedata 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 in theconnections type. Relational Connection Browser window opens up.
Select SERVER_TARGET_Conn. Click OK.
8/6/2019 a Power Center 8x Hands Onp.unlocked
33/39
PowerCenter 8.x Basics Case Study
Internal use 33
For target TARGET_ITEMS_ORDER2 select SERVER_TARGET_CONN as connection type.
esigner from the menu.
e default.dy3 task from session folder in
Choose tasks link task from the menu.
orkflow Monitor
Open the Workflow Monitor and connect to the Informatica server.the menu.
rkflow in
of session and the workflow. The required final data is
SING LOOKUP TRANSFORMATION
uration : 15 minutesRDER2
aving completed the first threesteps of our Solution Roadmap, we move on to the last
In the target Attributes select Normal as the target load type and Truncate TableOption for truncating the table prior to any loading.
Click Apply and then OK. Choose tools workflow d Click workflow create from the menu. Name the workflow w_CaseStudy3. Click Ok. A workflow is created with the Start task as th From the Navigator window drag and drop the s_CaseStu
the Case Studies folder.
Connect the tasks with the link.
Do Repository Save.
W From the workflow monitor choose Workflows Start Workflow from The Workflow monitor shows the running and status of the session and the wo
Gantt chart and task view mode. See for the successful completion
loaded into the TARGET_ITEMS_ORDER.
UDSource Definition : TARGET_ITEMS_OTarget Definition : TARGET_ORDERS_COST
Hstep wherein we using the above target definition as source, use the sorter and aggregator to
8/6/2019 a Power Center 8x Hands Onp.unlocked
34/39
PowerCenter 8.x Basics Case Study
Internal use 34
calculate the TOTAL_ORDER_COST for each Order by taking the aggregated sumof ITEM_COST
grouped byORDER_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 alreadyconnected.
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 toimport the definition already created as target in target database.
Enter User Name of the Target Database, Owner Name and the password of the TargetDatabase. 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 thenavigator window. Click Ok.
Click the sources folder and drag and drop TARGET_ITEMS_ORDER2 table definitionunder TUTORIAL_TARGET data source to the mapping designer workspace. Here weare using the target as the source.
The source definition of the table TARGET_ITEMS_ORDER2 is shown in the workspace. Do Repository Save.
8/6/2019 a Power Center 8x Hands Onp.unlocked
35/39
PowerCenter 8.x Basics Case Study
Internal use 35
Create Target Definition
From the tools menu select Target designer. We will use ORDERS definition from thesources 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 transformationsMenu.
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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
36/39
PowerCenter 8.x Basics Case Study
Internal use 36
Double click the heading part of the LKP_OrderID. The Edit Transformations windowopens up. Click on the ports tab.
Add a new field IN_ORDER_ID with datatype and precision same as ORDER_ID. Make itInput-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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
37/39
PowerCenter 8.x Basics Case Study
Internal use 37
Completing the mapping
Click the mappings folder in the Case-Studies folder and drag the targetTARGET_ORDERS_COST in the mapping from target instances.
Connect the corresponding Fields of SQ_ORDERS and LKP_OrderID andTARGET_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 datainto 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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
38/39
PowerCenter 8.x Basics Case Study
Internal use 38
In the sources select SQ_TARGET_ITEMS_ORDER2. Then click the in theconnections 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 lookupsource. 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.
8/6/2019 a Power Center 8x Hands Onp.unlocked
39/39
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.