Previous row value
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 55
- Joined: Tue Sep 20, 2005 10:58 am
Previous row value
Hi All
I am using the 8.0 version and have the following logic in the transformer to get the previous row value checked to raise unique sequence numbers
Mapping as viewed in transformer
<B>Derivation -------------------------> stage variable</B>
SOURCE COLUMN ------------------------------ > currentvalue
if currentvalue <> previousvalue then ----> mycounter
myycounter=mycounter+1 else mycounter
currentvalue ----------------------------------> previousvalue
But my previous and current columns are identifical when i view them in the next stage
Any ideas what is missing here
arvind
I am using the 8.0 version and have the following logic in the transformer to get the previous row value checked to raise unique sequence numbers
Mapping as viewed in transformer
<B>Derivation -------------------------> stage variable</B>
SOURCE COLUMN ------------------------------ > currentvalue
if currentvalue <> previousvalue then ----> mycounter
myycounter=mycounter+1 else mycounter
currentvalue ----------------------------------> previousvalue
But my previous and current columns are identifical when i view them in the next stage
Any ideas what is missing here
arvind
-
- Participant
- Posts: 55
- Joined: Tue Sep 20, 2005 10:58 am
-
- Participant
- Posts: 55
- Joined: Tue Sep 20, 2005 10:58 am
-
- Participant
- Posts: 55
- Joined: Tue Sep 20, 2005 10:58 am
Re: Previous row value
Of course, because your last stage variable derivation makes them the same and rightly so:aramachandra wrote:But my previous and current columns are identifical when i view them in the next stage
Nothing looks obviously wrong to me, what output are you actually getting?aramachandra wrote:currentvalue ----------------------------------> previousvalue
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 55
- Joined: Tue Sep 20, 2005 10:58 am
-
- Participant
- Posts: 55
- Joined: Tue Sep 20, 2005 10:58 am
-
- Participant
- Posts: 55
- Joined: Tue Sep 20, 2005 10:58 am
Thanks it partly worked
As suggested I set the default to "$" for the previousvalue variable and "?" for the currentvalue variable
I added another output column with Y AND N indicator for the change
if PreviousValue <> CurrentValue then 'Y' else 'N'
This above statement seem to be recognizing the previousvalue and evaluating correctly
But then I have a simple statement like
if PreviousValue <> CurrentValue then myCounter = myCounter +1 else myCounter
with myCounter having a default value of 0
That seems to always evaluate to 0
As suggested I set the default to "$" for the previousvalue variable and "?" for the currentvalue variable
I added another output column with Y AND N indicator for the change
if PreviousValue <> CurrentValue then 'Y' else 'N'
This above statement seem to be recognizing the previousvalue and evaluating correctly
But then I have a simple statement like
if PreviousValue <> CurrentValue then myCounter = myCounter +1 else myCounter
with myCounter having a default value of 0
That seems to always evaluate to 0
-
- Participant
- Posts: 55
- Joined: Tue Sep 20, 2005 10:58 am
Thanks it partly worked
As suggested I set the default to "$" for the previousvalue variable and "?" for the currentvalue variable
I added another output column with Y AND N indicator for the change
if PreviousValue <> CurrentValue then 'Y' else 'N'
This above statement seem to be recognizing the previousvalue and evaluating correctly
But then I have a simple statement like
if PreviousValue <> CurrentValue then myCounter = myCounter +1 else myCounter
with myCounter having a default value of 0
That seems to always evaluate to 0
As suggested I set the default to "$" for the previousvalue variable and "?" for the currentvalue variable
I added another output column with Y AND N indicator for the change
if PreviousValue <> CurrentValue then 'Y' else 'N'
This above statement seem to be recognizing the previousvalue and evaluating correctly
But then I have a simple statement like
if PreviousValue <> CurrentValue then myCounter = myCounter +1 else myCounter
with myCounter having a default value of 0
That seems to always evaluate to 0
How 'like' that is it? Your syntax as posted is invalid if that's literally what you have in the derivation. It should be:aramachandra wrote:But then I have a simple statement like
if PreviousValue <> CurrentValue then myCounter = myCounter +1 else myCounter
Code: Select all
if PreviousValue <> CurrentValue then myCounter+1 else myCounter
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 55
- Joined: Tue Sep 20, 2005 10:58 am
No laughing here, just a learning opportunity. Sometimes it's hard to tell if something is wrong or right when someone says "I have something like this" in a job, your first inkling is to give them the benefit of the doubt and assume they've really got it correct. However, if we dig deeper and things still don't work we revisit those assumptions.
Glad you got it sorted out, please officially mark the post as Resolved - there's a button at the top of the screen for that.
Glad you got it sorted out, please officially mark the post as Resolved - there's a button at the top of the screen for that.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: