compare values in transformer stage
Moderators: chulett, rschirm, roy
You've got all the logic you need right here.
One issue could be your incoming data is not sorted properly. Another consideration could be the number of nodes this job is running on, if it is running on more than one node you'd need make sure you hash partition properly on the value(s) you are using to check for duplicates.
So... what exactly about this doesn't seem to be working for you?
One issue could be your incoming data is not sorted properly. Another consideration could be the number of nodes this job is running on, if it is running on more than one node you'd need make sure you hash partition properly on the value(s) you are using to check for duplicates.
So... what exactly about this doesn't seem to be working for you?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
You need two stage variables
IsDup - set initial value to 0 and set the derivation as:
IF DSLink2.deptno = LastValue THEN 1 ELSE 0
LastValue - set initial value to 0 (or any value that will not match anything coming in from the source) and set the derivation as: DSLink2.deptno
Then in your output link you need a constraint: IsDup = 0
That should do it.
IsDup - set initial value to 0 and set the derivation as:
IF DSLink2.deptno = LastValue THEN 1 ELSE 0
LastValue - set initial value to 0 (or any value that will not match anything coming in from the source) and set the derivation as: DSLink2.deptno
Then in your output link you need a constraint: IsDup = 0
That should do it.
Computer analyst to programmer: "You start coding. I'll go find out what they want."
So... in other words, exactly what's already ready been posted as being used.
Me, personally, I would rely on the expression automatically assigning the proper values, there's no need to do it "manually". Then treat the result as the Boolean it is.
IsDup: DSLink2.deptno = LastValue
Constraint: Not(IsDup)
Me, personally, I would rely on the expression automatically assigning the proper values, there's no need to do it "manually". Then treat the result as the Boolean it is.
IsDup: DSLink2.deptno = LastValue
Constraint: Not(IsDup)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Thanks for the reply.
I got the output correct with the below formula.
Intial value = 0 for IsDup
Initial value =0 for currentvalue ( which is different from firstvalue in source)
If DSLink2.deptno = currentvalue then 1 else 0 = IsDup
DSLink2.deptno= currentvalue.
but, i do not want to initialize currentvalue as manually. any alternative mthod? pelase let me know
I got the output correct with the below formula.
Intial value = 0 for IsDup
Initial value =0 for currentvalue ( which is different from firstvalue in source)
If DSLink2.deptno = currentvalue then 1 else 0 = IsDup
DSLink2.deptno= currentvalue.
but, i do not want to initialize currentvalue as manually. any alternative mthod? pelase let me know
Is there any particular reason WHY you don't want to initialize currentvalue "manually"? It's both perfectly acceptable and is the correct method per standard programming practices in almost any programming language. There is no need or reason to use any alternative methods to accomplish this job.ravi7487 wrote:I got the output correct ... but, i do not want to initialize currentvalue as manually. any alternative mthod? pelase let me know
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
As noted, you are not "manually" initializing them, you are properly initializing them using the mechanism provided for exactly that purpose. Make sure you understand, however, that it doesn't need to be a hard-coded value there, you can use an expression or function or job parameter there for example.
ps. There's no need to initialize IsDup since it is set before ever being tested. Doesn't hurt, of course, but serves no purpose.
ps. There's no need to initialize IsDup since it is set before ever being tested. Doesn't hurt, of course, but serves no purpose.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers