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.

Featured Replies

I apologise if this is a complete 'noob' question.

I am writing a database to record scientific sample data. The established convention has been to name the samples with a 2 letter designation describing what the type of sample is and then a 2 digit serial number based on the sample type

e.g. OF01 OM01 OF02 SC01 OM02 OF03

I want to write a script that will generate that id number.

The only problem is that I have absolutely no idea how to do it!

I am presuming that I will have to find all the records that start OF. Then strip the last 2 characters, find the highest number and then add one.

All help will be greatly appreciated.

Many Thanks

First, to get the number portion of the text, use the GetAsNumber function.

Next, to get the highest number, use the Max function.

But the Max of what?

Set up a relationship of the table to itself based on the sample type. So your final calc would be:

Max( GetAsNumber( SelfBySampleType::ID ) ) + 1

You should be able to use that for auto entry, so you wouldn't necessarily need a script. If you do want to use a script, there are other ways you could accomplish the same thing. E.g., you could pop up a new window, find matching records, sort by id, then go to the last record, add one to that, then close the window.

  • Author

Thanks very much for your help! I had been going round in circles for over an hour before giving up!

Thanks again.

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.