Re: Delete duplicate records in FileMaker Pro 5
Re: Delete duplicate records in FileMaker Pro 5
- Subject: Re: Delete duplicate records in FileMaker Pro 5
- From: "Jason W. Bruce" <email@hidden>
- Date: Sun, 17 Dec 2000 12:04:04 -0600
Jason Bourque asked:
>
Hello,
>
>
does anyone have a script that deletes duplicate records in a FileMaker Pro
>
Database?
>
>
Thank,
>
>
Jason Bourque
The FMP 4 distribution included a sample AppleScript to remove duplicates.
I don't know if they included that in FMP 5. Below is a very quick and
mostly untested script that flags duplicates.
to getRecords()
tell application "FileMaker Pro"
set mainDatabase to {}
repeat with loopvariable from 1 to count records of database "Main
Database"
copy (a reference to (cell "Compare Cell" of record loopvariable of
database "Main Database")) to end of mainDatabase
end repeat
return mainDatabase
end tell
end getRecords
to FindDuplicates(mainDatabase)
set recordDeletionlist to {}
set counter to 0
repeat with loopvariable from 1 to count mainDatabase
if counter is not in recordDeletionlist then
set searchcell to item loopvariable of mainDatabase
set counter to loopvariable
repeat until (counter is (count mainDatabase))
set counter to counter + 1
if contents of item counter of mainDatabase is contents of searchcell
then
set end of recordDeletionlist to counter
end if
end repeat
end if
end repeat
return recordDeletionlist
end FindDuplicates
set mainDatabase to getRecords()
set recordDeletionlist to FindDuplicates(mainDatabase)
tell application "FileMaker Pro" to show (every record of database "Main
Database" whose cell "Compare Cell" is in recordDeletionlist)
Jason Bruce