I assign kids participating in a Pinewood Derby style car race to random lanes and heats with the random number function.
You assign a random number to a field and then sort on that field to put the records in random order.
Now go to record 31 and use Omit Multiple Records to Omit 9999 records so that you take just a random selection of 30 records.
if each question in the bank has a unique ID number going from 1 to X (the total # of questions). You could then
set $var to 0
have a random number generated from 1 to X.
find ID = Int(Random*x-1)+1
If used date -current date > 6 months
set question# to $var+1
set used date to current date
loop exit after var = 30
find used date = current date
Sort by var
Thanks for the help.Two other questions--
1. I am displaying the 30 selected questions on a new layout for printing. I'd like to also have a question number from 1-30 listed. I tried using Get RecordNumber and RecordID but those numbers are linked to the original record order, not the order in the found set.
2. I am having trouble with the script and finding questions that haven't been used in the last 6 months.
I have a Month Difference field that calcs: 12 * ( Year ( Get (CurrentDate) ) - Year ( Last Used ) ) + Month ( Get (CurrentDate) ) - Month ( Last Used )
The calculation is working properly.
My script is:
If Month Difference > 6
Sort & Omit
If I disable the If statement, the script runs fine. With the IF enabled, nothing happens. My sample records have a Month Difference value of 9.
1) If you make the calculation field unstored, get ( RecordNumber ) refers to the current order. You can also just put @@ on your layout and that will be displayed as the record number.
2) The first line of your script just checks the first record. It doesn't find any records.
Enter Find Mode //clear the pause check box
Set Field [Questions::MonthDifference ; "> 6" ]
Set Error capture [on]
If [ Get ( FoundCount ) > 29 ]
Replace field contents [ Questions::randomOrder ; Random ]
Sort [no dialog ; restore ] //sort on RandomOrder field
If [Get (Foundcount ) > 30 ]
Go To Record 
Omit Multiple Records 
Show Custom Dialog ["Not enough question records"]