Page 1 of 1

Multiple SNO's and Flagging them

Posted: Wed Jun 07, 2006 7:26 am
by vsi
Hi
i have a scenario like this

S.NO Code Flag1 Flag2 Flag3
123 so12 Y N N
123 So13 Y Y N


When Code matches then Flag 1,it is Marked as 'Y' and again when the same SNO comes again with diff. code then mark flag2 as 'Y' along with Flag1(we should not change the old one) when it does not match with FLAG1 or Flag2 then Flag3 should be 'Y'

Posted: Wed Jun 07, 2006 7:34 am
by ArndW
Sort your incoming data according to S.NO and Code, then use stage variables to store the values from the previous row so that you can use your logic.

Posted: Wed Jun 07, 2006 7:35 am
by DSguru2B
Sort your data by S.No
Use stage variables to check the current with previous.
Use if then else statements to set the values of the flags.

Hi

Posted: Wed Jun 07, 2006 7:48 am
by vsi
Hi,
I am New so Pls. give me more Info in Using Stage Variables,How to store SNO and compare with the new one


Thanks a lot

Posted: Wed Jun 07, 2006 7:55 am
by DSguru2B
This has been covered a lot here. Use the search facility.
For a start check out these two posts
POST1
POST 2

Re: Hi

Posted: Wed Jun 07, 2006 9:05 am
by rwierdsm
vsi wrote:Hi,
I am New so Pls. give me more Info in Using Stage Variables,How to store SNO and compare with the new one


Thanks a lot
3 Stage variables:

ThisRowValue => S.NO
CompareToLastValue => If ThisRowValue = LastRowValue then 1 else 0
LastRowValue => ThisRowValue

Since the stage variables get evaluated in order, the value from teh last row is maintained until the 3rd stage variable is reassigned. THIS MEANS THAT THE ORDER OF DECLARATION IS IMPORTANT.

(I had to find that out once the hard way :-))

Extend it for your two values.

Rob W.