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.

Preventing a duplicate record

Featured Replies

Hi, I'm writing a script to add "sessions" to my database.

Each session has "Session Date" and "Session Time" fields associated with it. I'd like to prevent the user from adding another record with the exact same date and time. I've created a third field with the date and time combined as a unique identifier.

I'm wondering what the best way is to compare this date/time field to existing records during record creation to make sure it doesn't already exist in the database.

 

I imagine this is a fairly simple and straight forward problem but I can't seem to get a grasp on it at the moment with my current FM knowledge. 

 

Thanks

You don't really need the combo field. Script the record creation. Have users enter a "new record" into global fields and click "Create." That script will use the global values to "find" and see if such a record already exists. If so, it tells the user and doesn't create the new record.

 

Other methods exist too, but this is my preferred.

  • Author

Thanks for the quick response.

I'm not sure I totally understand. Do you mean that I should make the Session Date and Session Time fields global?

By "Create" do you mean Commit the records?

Sorry for my naivety.

 

 

 

You don't really need the combo field. Script the record creation. Have users enter a "new record" into global fields and click "Create." That script will use the global values to "find" and see if such a record already exists. If so, it tells the user and doesn't create the new record.

 

Other methods exist too, but this is my preferred.

Hi, Doug:

 

I think what bcooney said was to create two GLOBAL fields to as intermediate data entry placeholders. The "Create" button she suggested runs a script that grabs the values in the GLOBAL fields, then uses them to perform a "Find" for the existence of such a record. If FoundCount = 0, it creates a new record and populates it with the data you have from the GLOBAL fields.

 

- - Scott

  • Author

Thanks Scott. That makes more sense now. I'll try it out.

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.