May 29, 200322 yr I have written a script to omit duplicate records, but for some reason it is not working correctly. What I want it to do is do a find on the field [invoice_id] and omit empty records and then omit any duplicate invoice_id's in the list. This is my script: Enter Find Mode set field [invoice_id, "*"] perform Find Perform [sort] go to record [First] set field [g_invoiceid, invoice_id] loop if [g_invoiceid = invoice_id] omit record go to record [next, exit after last] Else set field [g_invoiceid, invoice_id] end if end loop What's happening is that it omits the records even if they don't have duplicates. It omit every other records plus the duplicates. Could someone help me out and tell me what I did wrong?
May 29, 200322 yr Hi, Your script will automatically delete the first record so this is where your problem starts You have set the global field to the invoice_id of the first record, then the next step checks to see if the global = the id, and omits if it does, therefore the first record is omitted. You need to add in got to next record. Enter Find Mode set field [invoice_id, "*"] perform Find Perform [sort] go to record [First] set field [g_invoiceid, invoice_id] go to record [next] *****<<<ADD THIS LINE loop if [g_invoiceid = invoice_id] omit record go to record [next, exit after last] Else set field [g_invoiceid, invoice_id] end if end loop Ed.
Create an account or sign in to comment