Page 1 of 1

How to assign previous value to stage variable?

Posted: Tue May 11, 2010 10:35 pm
by taral
I want to remove duplicate using stage variable.
For doing this I need to compare the current value of column with the previous value.
How do I maintain previous value in the stage variable?

Posted: Tue May 11, 2010 11:51 pm
by kondeti
Use this logic.

SCurrent: Link.input_key
SCompare: If SCurrent=SPrev then SCompare+1 else 1
SPrev:SCurrent (Default it to some empty value like "")

Thank you.

Posted: Tue May 11, 2010 11:59 pm
by kondeti
Sorry missed most important thing.

Before applying the above logic, Please sort the data on the key column then apply above logic. Thank you.

Posted: Wed May 12, 2010 1:26 am
by taral
Thank You kondeti.

Do you mean
SCurrent value needs to be assigned to SPrev.

Posted: Wed May 12, 2010 6:55 am
by chulett
Yes. What is key to this is the order you declare the variables as they are evaluated top to bottom. That is what allows you to still know the "previous" value when the "current" value shows up.