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.

Random Selection

Featured Replies

I am currently creating a database which is used to create quiz questions. I would want to select 10 random questions from the database each time. Though these quiz sessions are unlikely to be very frequent, I would want this to function in a way that every time I open the database different questions need to be selected (I understand that 1 or 2 repetitions are inevitable)

The problem that I am facing is that I unable to create random selections quiz questions

Currently I am using a script as mentioned below

Randomfield (number) in the database

And have used the script

Go to Layout

Replace field contents(No dialog; table name::Randomfield; Random)

Omit multiple records (no dialog; 10)

show omitted records

I would be grateful if someone can help me with this

Thanks

Sanjay

Can you describe what result you are getting that isn't the result you want? It may help diagnose the issue.

Do you use the Show All Records script step before selecting random records? You should.

To be multi-user safe, improve performance, and have one fewer field in your schema, I recommend a slightly different approach:


Go to Layout [...]

Show All Records

Set Variable [$questionCount; Value:10]

Loop

Exit Loop If [Let ( $i = $i + 1 ; $i > $questionCount ) or Get ( FoundCount ) = 0]

Go to Record/Request/Page [/* By number */ Ceiling ( Random * Get ( FoundCount ) )]

Omit Record

End Loop

Show Omitted Only

try

Ceiling ( (Random)*100)

the 100 would be the total amount of questions you have.

then simply pull that question.

then loop 9 more times.

I think this is what you are asking ?

  • Author

Thanks very much for the suggestions.

I will try them out.

I have been using show all questions before the randomselection

But I think I must try out other things because what i get is still in a similar order (as my question numbers) rather than random and even if i get random questions, I get the same random questions with every log in.

Thank you

The reason your original script wasn't working is because you weren't sorting after the replace field contents step. But the previously suggested methods are much more efficient, so I would recommend using those.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

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.