Skip 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.

Duplicate record script help

Featured Replies

My goal of this script is to import records, then run a loop that checks the existing records to see if the "Serial No." matches a duplicate record. If there is a duplicate I would like a custom dialog to come up saying "Please check File for duplicates" and exit the script.

If there aren't duplicates I'd just like the script allow an import. I am a bit new to the ScriptMaker processes, and I tried using a loop with an if else but didn't have any success. Any help would be greatly appreciated.

Edited by Guest

...strange request, but never the less.

Sort Records by your serial number field then..

Go To Record[First]

Set Variable[$current ; serialNo]

Loop

Go To Record[Next ; Exit After Last]

If[serialNo = $current]

Show Custom Dialog[Error ; Duplicates exist]

Close File

End If

Set Variable[$current ; serialNo]

End Loop

  • Author

Yea sorry I miss worded my statement. Thanks for the help and I meant to say I only wanted to to import the records if there aren't any duplicates. I couldn't figure out how to include the "Import Records" portion and cancel the process if there is a duplicate. I am just trying to eliminate users importing multiple of the same records. Thanks.

So you wan tto check if there are any duplicate records in the set you want to import compared to the set that already exists?

  • Author

Yes, comparing the set of records imported to the already existing records.

Edited by Guest

Okkkayyyy.

Then, um. Scenario being... We've imported the records, if there are any duplicates, we remove all the imported records and "fail" the import - reverting all changes.

In that case we have imported the records and added one additional field to mark them as "imported".

So add one additional field, call it imported - then when you import your new records, run a loop through them and set the imported field to 1. i.e.

Loop

Set Field [imported = 1]

Go To Record[exit after last ; next]

End Loop

Then...

Show All Records

Sort[Just sort by serial No Here]

Go To Record[First]

Set Variable[$current ; serialNo]

Loop

Go To Record[Next ; Exit After Last]

If[serialNo = $current]

Enter Find Mode[]

Set Field[imported ; 1]

Perform Find[]

If[Get(LastError) = 0]

Delete Records[The delete all records option (will only delete foundset]

End If

Show Custom Dialog[Title: Error ; Message: Your import failed, there were duplicates. All imported records have been removed. Buttons: Ok , Quit]

If[Get(LastMessageChoice) = 1 //If Ok Button Pressed]

Exit Script

Else

Close File

End If

End If

Set Variable[$current ; serialNo]

End Loop

Half the stuff in there is just to show you how to use some of the features. But... yes i hope this helps.

As always, never work with your real data when debugging scripts like this - unless you know what your doing, and sometimes not even then. Make a copy of your file and play with that to your hearts content.

Good luck

~Genx

  • Author

Thank you very much I am about to go mess around with it

Oh right, btw... At the end - if there arent any duplicates, make sure you find the records marked "1" for imported and then unmark them all so they arent affected when the next import happens.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.