how remove duplicate in transformer

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
sureshbabu
Participant
Posts: 11
Joined: Fri May 29, 2009 9:54 pm
Location: hyd

how remove duplicate in transformer

Post by sureshbabu »

hi

can any body sugg me how do romoveduplecate in transformar stage useing stage varible


regards
sure
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

2 Stage Variables:

Code: Select all

svDuplicate          IF In.Key=svLastKey THEN 1 ELSE 0
svLastKey          In.Key
constraint "svDuplicate=0"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Or, exactly the same but my preference would be:

Code: Select all

svDuplicate        In.Key=svLastKey
svLastKey          In.Key
Constraint "Not(svDuplicate)"
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Craig, I agree with you - I would program it that way but expanded the logic to make the statement more understandable.
mk_ds09
Participant
Posts: 72
Joined: Sun Jan 25, 2009 4:50 pm
Location: Pune

Post by mk_ds09 »

You can use the following logic to remove duplicates using the Transformer Stage, however for that you need to have data sorted.

Before using the transformer Stage, use Sort Stage to sort the data.

In Transformer Stage, take the

FirstRecordVar=SecondRecordVar
IncomingLnk.Value=FirstRecordVar

Then in constraint you can put constraint like

FirstRecordVar<>SecondRecordVar

This will ensure that duplicates records are not passed to the next stage.

Hope this helps !
-----------------------------------
Regards
MK

What would you attempt to do if you knew you could not fail?

-----------------------------------
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ArndW wrote:Craig, I agree with you - I would program it that way but expanded the logic to make the statement more understandable.
Of course and I figured as much... just couldn't resist the perfect setup. :wink:
Last edited by chulett on Mon Oct 18, 2010 9:37 am, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
agpt
Participant
Posts: 151
Joined: Sun May 16, 2010 12:53 am

Post by agpt »

mk_ds09 wrote:You can use the following logic to remove duplicates using the Transformer Stage, however for that you need to have data sorted.

Before using the transformer Stage, use Sort Stage to sort the data.

In Transformer Stage, take the

FirstRecordVar=SecondRecordVar
IncomingLnk.Value=FirstRecordVar

Then in constraint you can put constraint like

FirstRecordVar<>SecondRecordVar

This will ensure that duplicates records are not passed to the next stage.

Hope this helps !
Hi Sorry to interrupt but how do you achieve :

FirstRecordVar=SecondRecordVar
?

What exact syntax is used for the same?
galmeida
Participant
Posts: 2
Joined: Mon Oct 27, 2008 9:00 am

Re: how remove duplicate in transformer

Post by galmeida »

sureshbabu wrote:hi

can any body sugg me how do romoveduplecate in transformar stage useing stage varible


regards
sure
Why not just use the de-duplicate stage?
Post Reply