3 Replies Latest reply on Feb 13, 2013 11:14 AM by philmodjunk

    How to get few records (random selection after previous filtering) from one big DB to another small...

    MarcosOkamura

      Title

      How to get few records (random selection after previous filtering) from one big DB to another small DB? (educational purpose)

      Post

           Dear all,

           I am new to FM and this forum. I need a support to solve a simple thing:

           Situation: I created three tables with fields:

           Table Questions: Discipline / Questions / Grade / Level  / IDQuestion_pk / SolvedfromStudent (10000 records)

           Table Studentes: Name / Grade / Level / IDName_pk

           Table Quizz: NumberofQuestions / Discipline /IDName_fk / IDQuestion_fk

            

           Table Quizz is related to Table Students (via IDName_fk and IDName_pk) and it is also related to Table Questions (via IDQuestion_fk and IDQuestion_pk).

           So, in a layout called QUIZZSELECTION, two fields will get some values:

           - NumberofQuestions will get a max number of questions

           - Dsicipline will get a required source matter

            

           As soon as NumberofQuestions will be less than the amount that I have recorded at Table Questions, once I have this amount, I want to select this total number of questions but:

           - Filtering from Table Questions with right Grade, right Level

           - Only Unsolved questions from the Table Questions (that's why I have a field named SolvedfromStudent)

            

           Problem:

           When a student is logging in, I need to display a quizz. The student will give desired number of questions and a discipline. I have to generate those questions choosing them in a randomic selection (checking if they match all filters and if they are unsolved). 

           I am not familiar to all tricks with script and functions, so I need a step-by-step of what to do (Script, function, Display as a portal or not, etc) .

           Besides, how can I create a specific table of Solved/Unsolved Questions for a certain student after this student has his quizz prepared?

           I kindly ask someone to help me.

           Thanks in advance.

        • 1. Re: How to get few records (random selection after previous filtering) from one big DB to another small...
          philmodjunk

               I don't think "solved from student" will work unless only one student uses any given copy of your database system.

               Looks like you need a table of student responses to the questions. Records in that table can be linked to questions from your questions table by your script. You never actually copy the questions from one table to another, you just put an ID value in each response record that links it to a particular question.

          • 2. Re: How to get few records (random selection after previous filtering) from one big DB to another small...
            MarcosOkamura

                 Hi Phil, thanks for your prompt answer.


                 I know that I will need a table of answer from each student (otherwise, I would not have a way to compare their answers and I wouldn't update each status of each question). But, as soon as I have to create DB for each student (for answer and solved/unsolved) it will be a mess to control.

                 So, I was thinking of having DB for questions and, when a student access the layout, the layout will choose randomic an amount of questions, show to the student and it will wait for all answers.

                 Then, with all answers, it will be calculated his/her performance and raise a level, if he/she reaches a good amount of solved exercises. 

                 I have 2 main problems:

                 1 - How to get an amount from a student and use it in a loop to get questions from DBQuestions (where, how to declare variables, how to use function random to generate a number (it will be used as IDQuestion_fk, etc)

                 2 - How to create a smart way to have SOLVED/UNSOLVED of each student without having to create specifics DB for it

                  

                 I am looking for answers of both, but I think 1 is easier than 2.

                 Can you help me?

                 Thanks!

                 Best Regards,

                 Marcos 

            • 3. Re: How to get few records (random selection after previous filtering) from one big DB to another small...
              philmodjunk
                   

                        But, as soon as I have to create DB for each student (for answer and solved/unsolved) it will be a mess to control.

                   My point exactly, your current method for determing which questions have already been answered doesn't look like it will work for multiple students using the same file unless you are intending to eliminage all questions for which any one student has answered. (If student A answers a question it's no longer available for all students, not just student A).

                   If you want to eliminate questions that a specific student has answered so that the student does not get the same question twice, I think you'll need to use something more sophisticated than a single field in the questions table.

                   I suggest you set up a related table that links to Questions like this:

                   Questions---<Answers>----Students

                   Questions::__pkQuestionID = Answers::_fkQuestionID
                   Students::__pkStudentID = Answers::_fkStudentID

                   See the first post of this thread for an explanation of my notation: Common Forum Relationship and Field Notations Explained

                   Now you can perform a find on the questions table to find all records that do not have a related record with a given student's ID to get all questions that a student has not answered.

                   What you are dealing with here very similar to a survey or questionaire--the difference being that you have right and wrong answers. This link on FileMaker Surveys may be helpful: Need aid on generating a report from a survey layout.

                   Once you have the basic structure in place, you can have a student enter a number into a global field and a script can find a set of unanswred questions, omit all but the number of questions specified in the global field and then can loop through them to set up a group of "answer" records linked to the current student and also linked to the question records pulled up by this script.