Page 1 of 1

before record and after record !

Posted: Wed Nov 29, 2006 11:54 am
by chandra
explanation :-
rec :-
1good
2good
3bad
4good
5bad
6good

these are the records comming from inputs file...

i want to capute the bad record as well as before and after records of bad i.e good rec.

like :- 3bad ,2good,4good as output
5bad,4good,6good.

ideas will be appricated
thanks in adv !

Posted: Wed Nov 29, 2006 12:12 pm
by Nageshsunkoji
Hi,

If your input data is coming from a database, first perform order by to group the data based on keys number and Good or Bad key and after that use the sort stage and select the keys and select the option Don't sort if previously grouped and change the settings of Create cluster key change column as 'True'. Now, If the record is order by based on keys, you will get the result for Create cluster key as 1 or 0. First if good is there it will be 0 and if its changed to 1 means it is Bad. Like that, for every change to good or bad. you will get the cluster key value as 1 or 0. Based on these perform some operations in the Transformer to get your required data.
Its just Idea, implement it, if it is satisfies your requirement.

Posted: Fri Dec 01, 2006 8:55 am
by chandra
good and bad are two different input file !
1- I think we need to merge both the good and bad .
2- then sort the good and bad based on some commom key !
3- assign some surrogate key to track the records .
< my question is i have to caputer the above and below record of bad>

4- collect the records of goodseq > badseq
5- goodseq < badseq.

now we got the records above ,below of bad .

FROM HERE -----ANY IDEAS .

before record and after record !

Posted: Fri Dec 01, 2006 11:25 am
by bsreenu
I think you can do this in 2 passes.

1- I think we need to merge both the good and bad .
2- then sort the good and bad based on some commom key !
3- assign some surrogate key to track the records . i.e assign a sequence number

4- collect the bad records and good records into a2 seperate files.

5- Take the bad records file and derive pre&post seq number. i.e.

seq1=badseq-1
seq2=badseq+1

6- Look-up good file using above seq1 and seq2.

now we got the records above ,below of bad .

Posted: Fri Dec 01, 2006 1:11 pm
by chandra
Yea ! Sounds grt8..