Robbydobbs Posted May 29, 2003 Posted May 29, 2003 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?
EddyB Posted May 29, 2003 Posted May 29, 2003 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.
Fitch Posted June 2, 2003 Posted June 2, 2003 Go to next record has to come AFTER the Else in your script.
Robbydobbs Posted June 3, 2003 Author Posted June 3, 2003 Thank you Fitch. I appreciate you clearing that up.
Recommended Posts
This topic is 7847 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now