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.

Importing without duplicating existing records

Featured Replies

Hello

  I have a database which imports data from a csv file. This csv file is generated by a machine usually every day. But it does not delete previous data, it just generates the whole data it has on the same file (overwriting it). Obviously I don't want duplicated records in my database.

  The first solution was to actually delete the whole records and re-import them, but this wasn't the preferred solution.

  So I thought of a second solution which I would like to share for any advice.

  I created a second table, Table_B with same fields as in first table Table_A. Then added a relation between the two tables where Table_A::field_a = Table_B::field_a. Then created a calculation field in Table_B which is equal to Table_A::field_a (Table_B::field_related = Table_A::field_a). The import has two steps, first I import from csv into Table_B then I perform a find where Table_B::field_related is empty and then I import what is found in Table_B into Table_A.

  I remember I have read time ago, in this forum I believe, a similar solution with related tables but different approach. Can not find that post.

  Do you think this is a good approach or can something be done differently?

  • Author

Yes comment, that can be used too, but it would still involve a find on Table_A since the update matching records works on current found set. Beside, who knows, maybe in future it will not be needed to update the imported records because of possible editing of the records.

2 hours ago, Toni said:

it would still involve a find

Isn't your import scripted? Surely the elaborate scheme you have described in your question would have to be scripted? As would be your current solution of deleting all existing records before importing new ones So the question you should be asking yourself is what is the simplest route to the desired goal. 

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.