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.

Shuffle field contents script?

Featured Replies

I'm hoping to piece together a script which shuffles the contents of three fields, but am not really sure if this is do-able, or where to begin.

Any ideas would be very welcome.

I have a DB with multiple-choice test questions in it, and each record has three fields [A, B, and C] with three possible answers in the; one of them is correct. I have another field [correct] with the correct answer to the record's question, and yet one more [answer] that returns either A, B, or C, depending on which field [A,B, or C] matches the correct answer [correct]. From there I have a few layouts that allow me to select records from the master DB to include in various versions of the test. All that works fine.

What I *want* to do is create a script which will shuffle the contents of fields A, B, and C around randomly within a record so I can quickly create different versions of the same test. Since the [correct] field wouldn't change, the [answer] field should still provide the correct match by locating the field [A, B, or C] which contains the right answer. I just can't crack how to randomly shuffle the contents of the three fields [A, B, and C].

Did that make sense? Hope so.

Any ideas, anyone?

Thanks in advance.

This is a little roundabout, but should work.

Number fields: Low and High

Randomizer, a calculated field:

Low + Round (Random * (High - Low), 0)

Global fields: gA, gB, gC

Script:

Go to Record (First)

Loop

Set Field (Low, 1)

Set Field (High, 3)

# This produces a random number between 1 and 3

Set Field (gA, Choose(Randomizer, "", A, B, C)

Set Field (gB, Choose(Randomizer, "", C, A, :

Set Field (gC, Choose(Randomizer, "", B, C, A)

# Your order will be ACB, BAC, or CBA

Set Field (A, gA)

Set Field (B, gB)

Set Field (C, gC)

Go to Record (Next, exit after last)

End Loop

If you want to be extra-random, run the script two or three times.

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.