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.

Reusing deleted serials

Featured Replies

I need to generate unique serial numbers in a limited range (lets say 100 -999). Since the range is limited it would be important to be able to reuse deleted serial numbers. Let´s say record 1 in a database gets sn. 100, record 2 gets sn. 101 etc. If I delete record 1, sn. 100 ought to be free to use... if I only could get a script to apply this to the next new record. Greatful for help }:|-)

PS. I´m using FM 6.

Create a global field named Serials. Create script with a loop and fill Serials field with you range of serial numbers ( return delimited list ).

Then create one script to add data and second to delete data.

In add script you grab serial number from Serials field with help of text functions ( also substitute it with "" so it dissapears from list ).

In delete script just grab current record serial, put it back in Serials field and delete record.

HTH

  • Author

Thank you DukeS, for your reply. I do follow your thoughts, managed to make a loop script to fill the Serials field with my range (is it ok with ", " as separator (1, 2, 3, 4, 5, ...) ?) but... I´m not good enough to figure out the syntax for the adding and deleting values from my Serial field. Any chance you could elaborate a bit... ?

  • Author

Aha... Solved the problem!! I tend to get stuck with FM:s "vocabulary". The MiddleWords-function was what I was looking for.

I am glad you made it...

For list of your serials I would suggest you to use return delimited list like:

serial1 & "¶" &

serial2 & "¶" &

...

lastserial

This gives you list like:

serial1

serial2

...

lastserial

instead of 1,2,3,4,...

It is easier to manage and read but I am not sure if FM6 has functions like MiddleValues to manage return delimited lists.

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.