Page 1 of 1

How to generate unique numbers only for duplicates

Posted: Fri Oct 12, 2012 4:39 pm
by synsog
Hi All,

I have a scenario like below.

Col1 Col2 Col3 Col4 Col5 Col6(seqno)
A Ram 1000 Ch Vi 1
B Krish 2000 BA SA 1
C MUR 3000 LA BU 1
C MUR 3000 LA BU 2
C MUR 3000 LA BU 3
C MUR 3000 LA BU 4
D ABR 1500 FA KL 1
E FBG 2000 BL RO 1



I am getting source data (Col1, Col2, Col3, Col4, Col5) and I have to generate the numbers for duplicate records like mentioned in Col6. For other than duplicates it's always 1.


As per I know we can generate 0 for duplicates using sort stage but how to generate the unique numbers to duplicate records please let me know.


Would appreciate your help.

Thanks,

Posted: Fri Oct 12, 2012 5:26 pm
by ray.wurlod
Use stage variables to increment the counter when there's a duplicate or to reset the counter when a new group starts.

Posted: Mon Oct 15, 2012 8:48 am
by RAJARP
Hey Synsog,
You might like this approach for your requirement.
http://dsxchange.com/viewtopic.php?p=41 ... d14#416088


Thanks,
Raja R P