Page 2 of 2

Posted: Thu Jul 23, 2009 3:30 am
by priyadarshikunal
In short "NO".

however once you have the desired output you can once again sort it in decending order.

Posted: Thu Jul 23, 2009 3:38 am
by balu536
Thanks to all who gave me the valuable suggestions.

As of now i sorted the data in ascending order and after getting the desired output i once again sorted to descending order which is some what time consuming process.

If any one tried this logic and achieved the required o/p with descending order of DATE in i/p please post here.

Thanks in Advance....

Posted: Thu Jul 23, 2009 4:33 am
by Sainath.Srinivasan
You can infact do it by descending date - if you are really really adamant.

You can send the years with corresponding previous year values followed by a lookup of the same in main stream.

Steps will be
1.) Send currentKey, currentYear, previousKey and previousYear values in another link (other than main stream)
2.) Using currentKey and currentYear, lookup same value in previousKey and previousYear and get currentkey and currentYear
3.) using values returned from 2 as current values, redo step 2
4.) Write record in output.

You can avoid multiple lookups by storing previous and previousPrevious values.

But again, it will be similar and quite complex than your current approach.

Posted: Thu Jul 23, 2009 7:01 am
by priyadarshikunal
Sainath.Srinivasan wrote:You can infact do it by descending date - if you are really really adamant.
That requirement will surely be for an Interview or Challenge to prove someone wrong. :wink:

one more way is to add two rows in source such that after sorting it goes to the last. Make sort sequential and in transformer(sequential) hold the records till the third record arrives.

Posted: Thu Jul 23, 2009 5:03 pm
by ray.wurlod
Don't bother to hold them. Use a downstream Remove Duplicates stage to transfer only the last row of each group.