Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7847 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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?

Posted

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.

Posted

Go to next record has to come AFTER the Else in your script.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.