General discussion

Locked

How do i retrieve a record from a database randomly?

By hoxt ·
Hi, I am developing a test ingine to run online testing software and i have one problem, i just cant seem to load the questions randomly from the database so that the exams dont look similar everytime they are loaded. can someone please help?

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

IS IIS?

by WilliamSanders In reply to How do i retrieve a recor ...

IF SO -
write a vfp component that handles your randomization.

regards [Bill]

Collapse -

Simple solution

by fred_krampe In reply to How do i retrieve a recor ...

use the random number generator (which generates a number between 0 and 1)and combine with the max record in the table.

See my example (not tested) below:
========================================
Use myTable

** init randomizer
=Rand(-1)

** set the number of questions to ask
nAsk = 20

For i = 1 To nAsk

nRec = Int(Reccount()* Rand()) + 1

Go nRec

?myTable.Question
Endfor
======================================

Back to IT Employment Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums