Hi fellow members of the Tango programming community!
I am actually kind of stuck on this and am wondering if you guys
could get me some insight. I'm attempting to get x number of random
questions from y which happens to the be total number of records.
This is for a online testing engine.
The steps below explain the logic.
1) Find total number questions needing to be randomized (assigned in
an <@ARG>) - let's say in this case we're looking at a total number of 7
2) Search database with all questions and store in all_questions array.
3) Create a blank array called create_test_questions with initial
value to be "0"
4) Create a blank array called empty array called random_question
with initial value to be "0"
5) Create a loop while the <@NUMROWS of create_test_questions> is
less than the total questions needing to be randomized (7)
5a. While in this loop, do the following:
<@ASSIGN name="random_question" value="<@RANDOM low='1' high='7'>
The high is being passed in argument form...I'm hardcoding here for
savings
<@ROWS array="create_test_questions" step="1">
<@IFEQUAL value1="@@request$create_test_questions[1,1]"
value2="@@request$random_question[1,1]>
<@ASSIGN name="already_there" scope="request"
value="Y">
</@IF>
<@IFEMPTY @@request$already_there>
<@ADDROWS array="create_test_questions" value="@@request
$random_question">
</@IF>
</@ROWS>
This created an infinite loop. I changed the loop to be a for loop
where the counter var is less than 7 and it's executing correctly,
but it's not adding to the create_test_questions array...
I might be kind of retarded here...but I don't really see what I'm
doing wrong...
any guidance would be much appreciated :)
____________________________________________________
Kaustav Acharya
Technical Customer Service Manager
U. Inc.
12250 El Camino Real, Suite #100
San Diego, CA. 92130
Office: (858) 847-3350 x1004
Fax: (858) 847-3340
email: [EMAIL PROTECTED]
http://www.colleges.com
____________________________________________________
All the News. No Ink. - http://www.onlinetimes.com
Power to the People - http://www.campaign.com
____________________________________________________
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf