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.

Auto generate next number

Featured Replies

Hello,

I need to make a function (or script) that will auto generate the next order number for me.

first 4 numbers:

the first 4 numbers are unique.

every order has to get a unique (next in line) number. 0001, 0002, 0003 and so on.

I dont wont it to have 'wholes' like 0001, 0003, 0004 because someone started to make 0002 and deleted it before commiting, so it has to check what was the last number that started with 0 (because we have old orders that start with 2010) and do a +1.

the 2nd part is also 4 numbers:

these numbers are given by us (client number)

and the last 2 numbers are shipment numbers.

this also has to check if the client already has an order and get the last shipment number and do a +1

so it should look like this:

0001-2222-01

0002-2233-01

0003-2222-02

0004-2222-03

0005-3333-01

0006-2233-02

0007-2222-04

I was thinking the function should be something like genOrder(client)

Anyone who can help making this effecient and bug free? thanx in advance!

Edited by Guest

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.