Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
prahlad_infy
Partner - Creator II
Partner - Creator II

How to flag single instance of duplicates different from other ?

Hello Sirs ,

What should be script the get result column of below data ?

Result - first value of result to be 1 and rest other 0 , while all distinct data to be 1 as well .

Duplicates:
LOAD * INLINE [

Input
Aquafina - 1000
Aquafina - 1000
Aquafina - 1002
Aquafina - 998
Aquafina - 999
Aquafina - 999
Aquafina - 999
Aquafina - 999
Aquafina - 999
Bisleri1
Bisleri1
Bisleri1
Bisleri1
Bisleri1
Bisleri2
Bisleri3
MAZA-FRITZO1
MAZA-FRITZO2
MAZA-FRITZO3
MAZA-FRITZO4
MAZA-FRITZO4
MAZA-FRITZO6
];

 

dups.PNG

 

Thanking in advance . 

3 Replies
sunny_talwar

Try this

Duplicates:
LOAD RowNo() as RowNum,
	 *,
	 If(Input = Previous(Input), 0, 1) as Result;
LOAD * INLINE [
    Input
    Aquafina - 1000
    Aquafina - 1000
    Aquafina - 1002
    Aquafina - 998
    Aquafina - 999
    Aquafina - 999
    Aquafina - 999
    Aquafina - 999
    Aquafina - 999
    Bisleri1
    Bisleri1
    Bisleri1
    Bisleri1
    Bisleri1
    Bisleri2
    Bisleri3
    MAZA-FRITZO1
    MAZA-FRITZO2
    MAZA-FRITZO3
    MAZA-FRITZO4
    MAZA-FRITZO4
    MAZA-FRITZO6
];
prahlad_infy
Partner - Creator II
Partner - Creator II
Author

Little changing and not working 

 

dups2.PNGdups4.PNG

sunny_talwar

I guess sort the data in a resident load and then apply the If... previous logic...