Delete Duplicate records

General support questions.
PostPosted: Tue Apr 04, 2006 2:51 pm
Hi!
newcomer to FM. have 8 version. Want to delete all duplicate records in a table but cant get the example in the helpfile to work
My table contains of 2 fields
Destination textfield
Rate numberfield
There are a lot of records with the same destination and rate that I want to delete
Please help
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Wed Apr 05, 2006 4:01 pm
Here is a simple way to do this...

a) Backup your file then find your dupe records.

b) Sort them by their dupe criteria (so that all the duplicates are next to each other).

c) Run the following script. Remember: this only works if your dupes are sorted as described above. If you're in FileMaker 7 or previous, set a global field instead of using the variable in this script. "YourField(s)" below represents the criteria by which you know a record is a dupe. In your case this might be your Destination and Rate appended to each other like this: Destination&rate

Code: Select all
Go to Record/Request/Page [ Last ]
Loop
   Set Variable [ $criteria; Value:YourField(s) ]
   Omit Record
   Loop
      If [ $criteria = YourField(s) ]
          Delete Record/Request [ No dialog ]
      End If
      Exit Loop If [ Get ( FoundCount ) = 0 or $criteria  =?  Far::url ]
   End Loop
   Exit Loop If [ Get ( FoundCount ) = 0 ]
End Loop
Show All Records
John Sindelar
SeedCode

Return to General Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron
(855) SEEDCODE
[email protected]
Follow us: