Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
jagjivvt
Creator
Creator

Identify and mark duplicate records in load script

Hi 

I need to mark each duplicate record in load script with an incremental number. 

InvoiceID, Mark

1 , 1

1, 2

2,1

2,2

3,1

 

and so on. 

thanks

 

 

Labels (1)
1 Solution

Accepted Solutions
LReeve
Contributor III
Contributor III

Hi Jagjvvt,

 

Try something like this:

tmpTable:

Load InvoiceID,

1 As Mark

From File;

 

NoConcatenate

FinalTable:

Load

InvoiceID,

If(InvoiceID = Previous(InvoiceID), Peek('Mark') + 1, Mark) As Mark

Resident Table

Order By InvoiceID;

 

 

You may need to also sort by a datetime value to mark the invoices correctly.

 

 

View solution in original post

2 Replies
LReeve
Contributor III
Contributor III

Hi Jagjvvt,

 

Try something like this:

tmpTable:

Load InvoiceID,

1 As Mark

From File;

 

NoConcatenate

FinalTable:

Load

InvoiceID,

If(InvoiceID = Previous(InvoiceID), Peek('Mark') + 1, Mark) As Mark

Resident Table

Order By InvoiceID;

 

 

You may need to also sort by a datetime value to mark the invoices correctly.

 

 

jagjivvt
Creator
Creator
Author

Thank you