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.

How to reset a serial number in a field?

Featured Replies

Hi

 

I have an auto entry calculation field with value from the field "serial" which has serial increment

 

Right(Year(Get (CurrentDate));2) & "-" & Right("0"&Month(Get (CurrentDate));2) & Right(("000"&serial);4)

 

The output of which is:  yy-mm#### ; 13-110435 .... 13-110436 .........

 

How can I make calculation to reset the value "serial" in order to start from 1 at the beginning of every new month

 

Thanks 

There is a script step for "Set Next Serial Number" if your "serial" is a true auto-enter serial field.

  • Author

With what I have, just creating a new record (Ctrl n) will show up the calculated value in the field "Case_ID"

 

Would this be still possible with the script? 

 

And the other thing how to auto reset the value when the month changes?

I think there are some assumptions here that are worth checking:

 

This script, attached to Case_ID with an OnObjectModify script trigger

Why would the user modify the Case_ID field?

 

Set Variable [$lastRecCalcMonth; Value:GetNthRecord (YourTable::Case_ID ; Get ( RecordNumber )-1)]

You are assuming that the most recent record is included in the current found set, and that the current sort order places it just before the current record.


Note also that the script will run (probably) while the new record is still uncommitted. A second user, creating a new record while this one is still uncommitted, will reset the serial again and create a duplicate.


See also:
http://fmforums.com/forum/topic/90112-calculation-help-with-serial-in-pk/?p=413582

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.