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.

Script to automatically number records when some are pre-filled

Featured Replies

Hi,

I have a test question database (3,000 records) and need to prepare a subset (about 300 questions) for the printed exam. Each question needs to be numbered serially. However, some questions have already been pre-numbered (about a third of the 300 total questions). I can't figure out how to write a script that does this. I've been struggling with setting a variable field to increment, and then compare its value to the ItemNumber field, but I just can't figure out the If statements and loops.

So for example, if there are six records chosen for the exam (I can do a Find on a field called Use=1 to find this subset), of which three have already been assigned an ItemNumber (3, 5 and 6) and the other three are blank, how do I write this script? I need it to complete the ItemNumber fields of the remaining three questions to 1, 2 and 4.

Any help much appreciated! My head is spinning. :mellow:

However, some questions have already been pre-numbered (about a third of the 300 total questions).

What is the significance of these numbers (if any) in the context of the exam? How would you number the exam questions if, for example, one of the questions has been pre-numbered 7 (out of 6 questions)? Or if two questions selected for the exam have the same number?

  • Author

These questions were used on a previous version of the exam; we need to leave them in the same place on the current exam for a quality assessment that we do. Since they were used before on a printed exam, two questions will not ever have the same item number.

This is either very hard or very simple. It's hard to say with so little information.

Since they were used before on a printed exam, two questions will not ever have the same item number.

You had a printed exam of 100 questions?

  • Author

This is either very hard or very simple. It's hard to say with so little information.

You had a printed exam of 100 questions?

Well, I didn't want to either needlessly complicate things or give away too much information about the exam. Sorry if I haven't been sufficiently clear.

The exam is given annually and consists of about 350 questions taken from a database of 3,000 questions. This year, about 100 of the total 350 questions are ones that were used on a previous exam, and these must appear in the same place on the exam (i.e. have the same ItemNumber) as they were previously. The remaining 250 or so questions have ItemNumber fields that are blank. I need to number the blank ones, fitting them around the ones that already have their ItemNumber fields filled in.

I could have done this by hand by now, but I'm sure there's a better way to do it with a script.

I am afraid I don't see a simple way of doing this. Perhaps the attached may help.

Renumber.zip

---

BTW, I believe you should be using a separate table for selecting questions to include in a specific exam. Otherwise you have no history.

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.