Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Omitting duplicates in DB keeping one

Featured Replies

I have a large DB to which another DB refers to pick up some data. THE DB is however full of dupes - e.g.

shirts,blue,small

shirts,white,medium

shirts,grey,large,

shirts,blue,small etc

How would I find all the records which contain: shirts,blue,small (let's say there are 50 of them) and then keep just one of them. Also, assuming there are 2,500 different products e.g. shoes, t-shirts, ties etc - how can I do it for each product automatically without doing a separate find and delete each time?

I can find the dupes (using !) the problem is it finds all of them. So, even if I omit dupes then I have none left of any one record.

Edited by Guest

This is a great discussion from Six Fried Rice's blog:

http://sixfriedrice.com/wp/deleting-duplicate-records-in-filemaker/

Pay attention to the need to preserve relationships, when deleting duplicates!

  • Author

OK tried this and another script and not getting very far with either. Something might help me: how can I outout a file which has only one example of each entry in a field. So in the example it would output "shirts,blue,small" to a file but only once.

Well, "shirts, blue, small" which I assume is not your real data represents three fields: item, color and size. So, I'd concatenate these fields to be:

item & "|" & color & "|" & size.

Then, I'd subsummary by that field and export the recs grouped by the subsummary.

See JMO's site http://www.databasepros.com/FMPro?-DB=resources.fp5&-lay=cgi&-format=list.html&-FIND=+&resource_id=DBPros000744

type in "duplicates" - he has several techniques.

  • Author

I tried using this script:

Sort Records [ No Dialog; cDupKey ]

Go to Record/Request/Page [ First ]

Set Variable [ $DupCheck; cDupKey ]

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

Loop

If [ cDupKey = $DupCheck ]

Delete Record [ No Dialog ]

Exit Loop If [ get(recordnumber) = get(foundcount) ]

Else

Set Variable [ $DupCheck; cDupKey ]

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

End If

End Loop

It didn't work as is so I had to add in the line with the chevrons then it did.

Sort Records [ No Dialog; cDupKey ]

Go to Record/Request/Page [ First ]

Set Variable [ $DupCheck; cDupKey ]

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

Loop

Copy [select;cDupKey ] <<<<<<<<<<<<<<<<<<<<<<

If [ cDupKey = $DupCheck ]

Delete Record [ No Dialog ]

Exit Loop If [ get(recordnumber) = get(foundcount) ]

Else

Set Variable [ $DupCheck; cDupKey ]

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

End If

End Loop

That doesn't make sense. cDupKey must NOT be set to global storage, but simply a calc field in your table. Could that be the problem?

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.