Load only the First and Last Record

How to load only the first and last record of a flat file into the target?

Questions by thallojur

Showing Answers 1 - 33 of 33 Answers

Jitendra

  • Aug 23rd, 2013
 

You can get the First & last Record through Rank T/R bcz in Rank T/R it will filter numeric and string data.

  Was this answer useful?  Yes

From Source Qualifier transformation, separate 2 pipelines,
1st pipeline, Aggregator transformation to generate the last row(do not use group by)
2nd pipeline, Aggregator transformation with FIRST() command to generate the first row.
Use Union transformation to merge the 2 rows and push to target.

  Was this answer useful?  Yes

janakiram

  • Oct 16th, 2013
 

S--->SQ--->Exp--->Jnr---->Filter--->Target
Seq

Exp:
Drag Nextval to Exp. Create
O_Dummy 1

Agg:
Drag Nextval to Agg
O_Count Count(Nextval )
O_Dummy1 1

Joiner:
O_Dummy=O_Dummy1

Filter:
Nextval=1 and Nextval=O_Count

Connect required ports from Filter to Target

  Was this answer useful?  Yes

krish

  • Oct 16th, 2014
 

Java transformation in Informatica PowerCenter uses Java programming language to transform the data.
It is not necessary to write the entire Java code or use an external Java development environment as the Java code can be entered as snippets in the PowerCenter Designer client.

The code in Java transformation can invoke Informatica's custom expressions, user-defined functions, unconnected transformations and mapping variables. Java methods, variables, third-party API's, built-in Java packages and static code can be invoked as well.


http://netezzamigration.blogspot.com/search?updated-max=2014-10-16T07:18:00-07:00&max-results=1

  Was this answer useful?  Yes

Yagvendra Naruka

  • Dec 2nd, 2014
 

We can perform this with the help of two aggregator transformation.
We will first assign a sequence number to each row. Assigning sequence number can be done either by sorter or expression transformation. After assigning sequence bring all the columns to two different sorters and sort one with ascending and other with descending. Now pass all the rows into two different aggregators and without any change pass it into two instances of target. What aggregator will do it will automatically pass the last row. So for the first aggregator which is getting ascending rows it will pass the max row i.e last row and for the descending aggregator it will pass the min row i.e first row
Source==>SQ==>EXP(seq generated)==>sort1(ascending)==>Agg1==>TGT instance1
==>sort2(descending)==>Agg2==>TGT instance2

  Was this answer useful?  Yes

SANSO

  • Jan 20th, 2015
 

Why you are using joiner transformation....Could you please explain briefly

  Was this answer useful?  Yes

GATLA DILEEP REDDY

  • Feb 16th, 2015
 

head -1 > file name1 >
and tail -1 > file name 1>> input file

  Was this answer useful?  Yes

Raghav

  • Apr 4th, 2015
 

Using rank and expression transformation.
More details at below link
http://www.raghavatal.com/2015/04/04/how-to-load-only-the-first-and-last-row-from-a-flat-file-to-a-target-file/

  Was this answer useful?  Yes

kishor Baindoor

  • Jan 23rd, 2016
 

Connect source to two aggregator and then union it. In aggregator, if we donot check any column for aggregation then it will return last record by default. We can change this property in 2nd aggregator to return first record. When we union it we will get first and last record.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions