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.

commit record, and duplicates

Featured Replies

We have a sku number generator set up with all the fields being required before moving on. This is done in the Define Data / fields settings. One field is automatically calculated with a sequential sku number unique to each file. We added a "commit record" line in the script to force a save as soon as the sku number is created. The user then has to finish entering the required fields before moving on. The goal was to prohibit duplicated numbers being created if two users were accessing this tool at the same time. It seemed to be working, but then we caught a duplicated sku number. It seems that the "commit record" in the script is not committing until all the required fields are complete (a requirement). Is there anyway to force a commit, so the record is saved, temporarily overriding the field fill requirements (invisible to the user), but then bring the user back to the fields for completion?

Here is what we have today in the "add sku" script:

New Record/Request

Allow User Abort [Off]

Set Error Capture [On]

Commit Records/Requests [No dialog]

Set Error Capture [Off]

Any help is appreciated. We really need this running and not allowing duplicate numbers.

thanks

Edited by Guest

Is the SKU field set to auto-enter a serial, validate unique, and prohit modification. If so, you will always have a unique SKU, no scripts needed. Even in a multi-user environment, FM will take care of your requirement that SKU is unique. What are the settings on SKU?

  • Author

Sorry for the time lapse, I've been under the weather over the past week.

The settings on the sku are:

Indexed, Auto-enter Calculation replaces existing value, Evaluate Always, Can't Modify Auto, Always Validate, Unique

Why is it an auto-enter calculation and not just a serial number? Big rule of thumb, key fields are meaningless serial numbers!

  • Author

The reason it is calculated is that it is not a key number. It is actually a product number. We need to keep them in sequence, without skipping numbers. A serial number, counts every trial, deleted or not, which gives us blanks and missing numbers. It needs to check the existing set of records, then create the next in order.

This specific example is straight forward, as K####. However the next portion I have to build gets more complex. There are variations dependant upon the product and customer. For example a H068H, U068H and A068H are all very different items. There are additional complexities, but if we can get the file to lock down, those can be dealt with.

Any thoughts?

These puzzles aren't my strong point. I've never created by calculation unique values. LaRetta, Vaughan, Comment, are you willing to take this on? I bet there's already a post that answers this question, although I couldn't find it.

Well, the Set Error Capture [On] is good to have if you're checking for Unique values in the field definition, but you need to actually trap for it with a Get(LastError).

Something like...

Set Error Capture[On]

Loop

Commit Record

Exit Loop If[Get(LastError) :notequal: 504]

Show Message["That SKU Num is being used, please enter a new one." Add the SKU field here too]

End Loop

Set Error Capture [Off]

  • Author

Thanks,

I got pulled to another item. I will get back once I've had a chance to try these out.

The reason it is calculated is that it is not a key number. It is actually a product number.

So, you have a serial number unique key field for use in relationships, and this is just a display?

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.