Would we have to do a DBMS query on this, or can it be done in the Search action?
____________________________________________________
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
____________________________________________________




On Feb 28, 2008, at 11:08 AM, William M Conlon wrote:

I would do it in the query

SELECT question_text, RAND() as random FROM questions ORDER BY random LIMIT 7

Bill

William M. Conlon, P.E., Ph.D.
To the Point
2330 Bryant Street
Palo Alto, CA 94301
   vox:  650.327.2175 (direct)
   fax:  650.329.8335
mobile:  650.906.9929
e-mail:  mailto:[EMAIL PROTECTED]
   web:  http://www.tothept.com


On Feb 28, 2008, at 10:58 AM, Kaustav Acharya wrote:

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
______________________________________________________________________ __
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf



________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to