Finding Duplicated

nate100

Member
I need to write a code that find duplicate invoice numbers for the same vendor in a table. How could I do this with buffers? Or what would be the best way to do this?
 
def buffer b_invoice for invoice.

for each invoice where [Invoice Criteria here] no-lock:
find b_invoice where b_invoice.invnum = invoice.invnum no-lock no-error.
if ambiguous (b_invoice) then display invoice.invnum.
end.

You have to change the table names and field names and put some criteria in, but that's the easiest way of doing it, I think.

You could put the following instead of the find b_invoice:

invoice_count = 0.
for each b_invoice where b_invoice.invnum = invoice.invnum no-lock:
invoice_count = invoice_count + 1.
end.
if invoice_count > 0 then display invoice.invnum invoice_count.
 
Back
Top