3. Design a mapping to load the last 3 rows from a flat file into a target?
Solution:
Consider the source has the following data.
col
a
b
c
d
e
Step1: You have to assign row numbers to each record. Generate the row numbers using the expression transformation as mentioned above and call the row number generated port as O_count. Create a DUMMY output port in the same expression transformation and assign 1 to that port. So that, the DUMMY output port always return 1 for each row.
In the expression transformation, the ports are
V_count=V_count+1
O_count=V_count
O_dummy=1
The output of expression transformation will be
col, o_count, o_dummy
a, 1, 1
b, 2, 1
c, 3, 1
d, 4, 1
e, 5, 1
Step2: Pass the output of expression transformation to aggregator and do not specify anygroup by condition. Create an output port O_total_records in the aggregator and assign O_count port to it. The aggregator will return the last row by default. The output of aggregator contains the DUMMY port which has value 1 and O_total_records port which has the value of total number of records in the source.
In the aggregator transformation, the ports are
O_dummy
O_count
O_total_records=O_count
The output of aggregator transformation will be
O_total_records, O_dummy
5, 1
Step3: Pass the output of expression transformation, aggregator transformation to joiner transformation and join on the DUMMY port. In the joiner transformation check the property sorted input, then only you can connect both expression and aggregator to joiner transformation.
In the joiner transformation, the join condition will be
O_dummy (port from aggregator transformation) = O_dummy (port from expression transformation)
The output of joiner transformation will be
col, o_count, o_total_records
a, 1, 5
b, 2, 5
c, 3, 5
d, 4, 5
e, 5, 5
Step4: Now pass the ouput of joiner transformation to filter transformation and specify the filter condition as O_total_records (port from aggregator)-O_count(port from expression) <=2
In the filter transformation, the filter condition will be
O_total_records - O_count <=2
The output of filter transformation will be
col o_count, o_total_records
c, 3, 5
d, 4, 5
e, 5, 5
Wednesday, December 5, 2012
3. Design a mapping to load the last 3 rows from a flat file into a target?
Subscribe to:
Post Comments (Atom)
Tags
Architecture of UNIX
(1)
Basic Unix Commands
(1)
Data warehousing Quiestions1
(1)
Debugger
(1)
Downloads
(1)
ETL Process
(1)
Fundamentals of UNIX
(1)
Get top 5 records to target without using rank
(1)
Home
(1)
How do you perform incremental logic or Delta or CDC
(1)
Incremental Loading for Dimension Table
(1)
Informatica Complete Reference
(1)
Informatica Functions
(1)
Informatica Powercenter Architecture
(1)
informatica project
(1)
Informatica Quiestions
(1)
Informatica Quiestions3
(1)
Informatica Real time Scenarios
(2)
Informatica scenarios
(3)
Integration Testing
(1)
Introduction of Unix
(1)
Oracle Queries
(1)
Power center Client
(1)
Separate rows on group basis
(1)
TESTING-User Acceptance Test
(1)
Unit Testing
(1)
Unix
(2)
What is informatica
(1)
Iam really satisfy by your information.
ReplyDeleteIt's well-written, to the point, and relative to what I do.
I like it very much for giving information on
Excellent Informatica Online Training .
This article is very nice and informative to learners
ReplyDeleteInformatica training, informatica training in bangalore, informatica online training
I have a question. Can you please explain why checking the sorted input option in joiner transformation allows us to connect both expression and aggregator transformations to joiner transformation? Did not really understand the reason.
ReplyDeleteyou can even use MOD function to get the last 3 records..
Deleteyou can not connect two active transformation in parallel, to connect active transformation, we are using joiner and its by default compulsion to tick on sorted input, if you will not tick on it then it would never connect the port from another transformation .
Deleteand whenever you tick on sorted input, it considers the master table is already in the sorted form.
take seq no, take a rank and choose bottom 3 rank connect to target... is it simple?
ReplyDelete