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.

serial number by year

Featured Replies

Hi everyone,

I have a question (who doesn't):

I want to make a serial number field that increments by 1 every time a new record is created and resets itself when a new year starts. How can i do that?

GreetZ

[ January 16, 2002: Message edited by: nowayback ]

First, I presume you are not using this serial number as a primary key for a record. If you are, then don't reset it of course.

Have a script that checks to see if the current date is the date on which you wish to reset the serial number. If it is, use the Set Next Serial Value script step and have it reset the field to whatever initial value you want it to have.

I'd be careful with this.

HTH

Old Advance Man

Hi,

Here is what I have done:

Make a Numberfield: "YearSerialNumber"

Make a Globalfield: "YearSerialNumberGlobal"

Make a Calculationfield: "YearSerialNumber2"

Then a script:

Set(YearSerialNumber) ; If(Left(YearSerial number;4)< Year(Today)or YearSerialNumber = "" ; Year(Today)&1 ; YearSerialNumberGlobal + 1)

Set(YearSerialNumberGlobal ; YearSerialNumber)

This make:

If the YearSerialNumber is empty you will have your first number.

Then it set the global field for use in next record.

If the first 4 digits (year) in the YearSerialNumber is lower than todays system year the script will set the new year and start with 1.

Instead of 1 you can add several zeros or whatever you want between the year and serial number.

You can also use only 2 digits for the year but then you need a additional field to get it work.

YearSerialNumber2:

Middle(YearSerialNumber;3;x)

3 = Starts with 3 rd digit in 2002 = 0

x = Length of longest serial number: 20020001 = 3;6

If you always want 6 digits you can make follow calculation in the "YearSerialNumber2" field:

If(Length(YearSerialNumber)=5;Middle(YearSerialNumber;3;2)& "000" & Middle(YearSerialNumber;5;1); "" ) &

If(Length(YearSerialNumber)=6;Middle(YearSerialNumber;3;2)& "00" & Middle(YearSerialNumber;5;2); "" ) &

If(Length(YearSerialNumber)=7;Middle(YearSerialNumber;3;2)& "0" & Middle(YearSerialNumber;5;3); "" ) &

If(Length(YearSerialNumber)=8;Middle(YearSerialNumber;3;2)& Middle(YearSerialNumber;5;4); "" )

Good luck

-Per

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.