Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dmac1971
Creator III
Creator III

Flagging Duplicates

I can easily enough find what records are duplicated :

if (peek('Line_ID',-1) = Line_ID ,'Dup','NoDup') as DupRec

But this will only mark the 2nd record, I need to mark the first one as well, ie mark them both as duplicate?


16 Replies
sunny_talwar

So, if I am thinking this correctly, I think the only places that would be left would be the places where you have 1st duplicates cause everything else will either have Dup or NoDup. Can you do something like this:

YourTable:

LOAD If(Len(Trim(DupRec)) = 0, 'Dup', DupRec) as DupRec;

LOAD if (peek('Line_ID',-1) = Line_ID ,'Dup','NoDup') as DupRec

             ....

From/Resident xyz

Order by Line_ID;

Let me know if it doesn't work.

Best,

Sunny

Not applicable

Hi Dermot,

Try like this....

if(Peek('Line_ID')=Line_ID,0,1) as Flag

from resident table

order by Line_ID

dmac1971
Creator III
Creator III
Author

Still gives the same result, only in reverse.

datanibbler
Champion
Champion

Hi Dermot,

I think, since QlikView loads the table one record at a time, from the top down, there's no way to do this in one go - you'll have to do one RESIDENT LOAD in reverse sorting order and do the same as the first time round.

Best regards,

DataNibbler

sunny_talwar

Did you take a shot at what I suggested? Just curious

Not applicable

Try Like this....

Order by Line_ID DEC

Not applicable

Could you use Peek('Line-ID', RowNo()+1,'table') to check for the next to get a flag on the first one too.

dmac1971
Creator III
Creator III
Author

OK Trying This :

If (Peek('Line_ID',-1) = Line_ID,'Dup', If(Peek('Line-ID', RowNo()+1,'Orders') = Line_ID,'Dup','NoDup')) as DupRec

Doesn't work either....

sunny_talwar

I guess for some reason you hate my suggestion. I was just trying to help.

I hope you get what you are looking for.

Best,

Sunny