Escolar Documentos
Profissional Documentos
Cultura Documentos
Informatica PowerCenter
Applies to:
Informatica PowerCenter
Summary
This article briefs about implementing FOR loop in Informatica using Java Transformation.
Author Bio
Author(s): Sukumar Balasubramanian
Company: CIBC
Created on: November 17, 2009
Sukumar Balasubramanian is an experienced Informatica ETL Consultant working with CIBC, Canada. He
has good exposure to Data Integration/Data Warehousing Projects. He is also a key contributor in
informatica-l group of ittoolbox .This is his first technical article in TechNet.
Table of Contents
INTRODUCTION ................................................................................................................................................ 3
REQUIREMENT ................................................................................................................................................. 3
SOURCE ......................................................................................................................................................... 3
TARGET .......................................................................................................................................................... 3
SOLUTION OVERVIEW ..................................................................................................................................... 4
SOLUTION STEPS ............................................................................................................................................. 4
SOURCE ......................................................................................................................................................... 4
EXPRESSION TRANSFORMATION .............................................................................................................. 4
JAVA TRANSFORMATION ............................................................................................................................ 5
TARGET .......................................................................................................................................................... 6
OUTPUT ......................................................................................................................................................... 6
ADVANTAGES ................................................................................................................................................... 7
DISCLAIMER AND LIABILITY NOTICE ............................................................................................................. 8
INTRODUCTION
This article briefs about implementing FOR loop in Informatica using Java Transformation.
REQUIREMENT
Consider that we are receiving a ‘|’ delimited flat file that contains the sales person’s tour information.
SOURCE
Our requirement is to generate Tour Table TARGET that contains the following
TARGET
SOLUTION OVERVIEW
To achieve the above requirement we will be using the Java Transformation available in Informatica
PowerCenter.
SOLUTION STEPS
SOURCE
Delimited Flat File TourInfo.txt
Salesperson Name | Tour from Date | Tour to Date | Place
Sukumar | 20091117 | 20091119 | Chennai
Ram | 20091117 | 20091119 | Bangalore
Sukumar | 20091120 | 20091122 | Bangalore
Ram | 20091120 | 20091122 | Chennai
EXPRESSION TRANSFORMATION
Expression transformation is used for retrieving the values from the flat file source and assigns values to
individual ports.
JAVA TRANSFORMATION
Link the FromDate_out, toDate_out from the Expression Transformation to the From Date and To
Date ports of the Java transformation.
• Under the Java code tab; Import Package tab place the below code:
Import java.util.*;
Import java.text.*;
This is to import relevant java packages.
• Under "On InputRow " tab place the following code
DateFormat formatter ;
formatter = new SimpleDateFormat("dd-MMM-yy");
FromDate_out =formatter.format(FromDate);
ToDate_out =formatter.format(ToDate);
TARGET
DataType
Description
OUTPUT
Source:
Sukumar | 20091117 | 20091119 | Chennai
Target:
Java transformation takes the ‘from date’ and ‘to date’ as input and a FOR loop is constructed.
For each input row based on the ‘from date’ and ‘to date’ java transformation will generate
multiple rows.
In our case for a single row in source we will be generating 3 rows in target.
ADVANTAGES