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.

Need Script to assign a unique number from a pool

Featured Replies

I Nedd a script that will allow me to assign a unique number to a record from a pool of numbers, let

How about this? The field "pool" is text and global. This is your pool of available numbers ("1 2 3 4 5")

You create two simple scripts for 'NewRecordScript' and 'DeleteRecordScript'.

NewRecordScript creates a new record.

Then sets field "id" to leftwords(pool,1) - The next available from the pool.

Then sets field "pool" to rightwords(pool,wordcount(pool)-1) - Taking away the used left ID

-

DeleteRecordScript first sets field "pool" to pool & " " & id - Making the number available again

Then deletes the record.

-

Check the attached file if you like

Sorry - forgot the file attachment.

pool.fp5.zip

This is okay if it doesn't matter in what order you assign the numbers. Since you may delete record 5 then 2 then 3, these numbers will be appended back onto the list in that order and will be re-assigned in that order. If you want to always assign the lowest available number, then you will have to add a bit more to the script to keep things sorted.

Another option is to use a separate file with one record for each number in the pool with a field containing the number, and a field called "available". Set this field to 1 when the number is available, and clear it when the number is assigned. You can then set up a constant relationship "PoolAvailable" from a global = 1 in the main file to the available field in the pool file. Also create a relationship "Pool" from the main file to the pool file based on the number field in each.

To assign a number, run this script in the main file

Set Field [iDnumber,PoolAvailable::IDnumber]

Set Field [Pool::Available, ""]

To delete the record and return the number to the pool run this script:

Set Field [Pool::Available,1]

Delete Record

See the attachment.

Pool-o-numbers.zip

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.