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

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

Recommended Posts

Posted

Call me dense, but it seems to me that most of the "find duplicate" scripts I've seen posted (as well as in the FM Pro 5 User's Guide - see pg 10-13 ) really only find duplicates which are next to each other, i.e., concurrent duplicates.

Right now, I'm trying to write a script which will find all duplicates (regardless of whether they're concurrent or not) and show them in a layout. In my case, the unique field is a calculation field and thus I cannot simply enforce it's being unique (like you can with a simple text or number field).

I'm using the "create a Mark and Global field" approach used in the User's Guide modified to also find non-concurrent duplicates. Here's what I have so far:

Show All Records

Sort[Restore,No dialog]

Go to Record/Request/Page [First]

#Get first UniqueID to search remaining records for

Set Field ["global", "MyUniqueID"]

Loop -----#this is the outer loop

Go to Record/Request/Page [Next]

Loop ----#this is the inner loop

If ["global = MyUniqueID"]

Set Field ["Mark", ""x""]

End if

Go to Record/Request/Page [Exit after last, Next]

End Loop

#go to the next record in the outer loop

Go to Record/Request/Page [Exit after last, Next]

#Get the next UniqueID to search for

Set Field ["global", "MyUniqueID"]

End Loop

Perform Find[Restore]

The intended logic is pretty clear. Go to the first record, get the UniqueID, and then loop thru all the rest of the records marking any records that have the same Unique ID. Then exit the loop, and go to the second record, get the UniqueID and then loop thru all the rest of the records marking any records that have the same Unique ID. It should be pretty clear that by doing this, by the conclusion of the script all duplicate records will be marked.

However, this script doesn't work. The problem appears to be that the outer loop does not retain it's position in the recordset when the inner loop exits,..i.e., where it says above "#go to the next record in the outer loop", well,..it doesn't,..rather, the outer loop is positioned where the inner loop exited,..i.e., at the end of the recordset.

Any suggestions on how to maintain the recordset position in the outerloop??? or,..any idea on how I could modify the "finding duplicate records" script in the User's Guide to also find non-concurrent duplicates??

Thanks

Posted

Unless I'm missing something, you are making things very difficult, not to mention slow. If you sort your file on the field that contains the duplicates, then the duplicates WILL be concurrent. Then you can use the example given on page 10-13 in the manual.

This topic is 8359 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.