Page 1 of 1

Date Population

Posted: Tue Oct 05, 2010 9:33 am
by cherry
Hi All,

Good Day..,

I have the following requirement.
From the source I would get only the START DATE and I need to populate END DATE in the Output file.

Greatly apprciated if anyone has solution.


INPUT DATA
----------
ID NBR SEQNO START DATE
7856 01 20100905 10:12:45
7856 01 20100905 10:16:14
7856 01 20100905 10:32:26


Scenario:
---------

1) If my source have only one record then my end date in the output is current time stamp.
2) If my source have more than one record, say it has 3 records. Then the END DATE for the first record is the
START DATE of the second record and the END DATE of the second record is START DATE of the third record and the
END DATE for the 3 record is CurrentTimeStamp(). The below is how the OUTPUT data looks like.

OUTPUT DATA
-----------
ID NBR SEQNO START DATE END DATE
7856 01 20100905 10:12:45 20100905 10:16:14
7856 01 20100905 10:16:14 20100905 10:32:26
7856 01 20100905 10:32:26 CurrentTimeStamp()

MANY THANKS
~~~Cherry

Posted: Tue Oct 05, 2010 2:54 pm
by anbu
Use transformer stage and have two links. One link with all the records and for other link remove the first record.

Create a dummy key in both these links and assign one to it.

Use these links as input to lookup stage on dummy key with link having all rows as main and other as reference.

The row which has date column from reference is null, assing current timestamp.

Run this job with one node configuration file

Posted: Tue Oct 05, 2010 3:50 pm
by ray.wurlod
You may find a Join stage better than a Lookup stage in this design.

Posted: Wed Oct 06, 2010 12:02 am
by cherry
Thanks anbu for th esolution. Let me try and get back to you.