3 Replies Latest reply on Mar 18, 2012 11:01 AM by philmodjunk

    Random name generator



      Random name generator


      Can anyone tell me how to create a random name generator using FM Pro 11. I intend to use it in lessons to select students to 
      answer questions.

      If I have a list of say 15 student names in a table and I hit a button, a random name from that list appears on the screen. The name 
      would be different each time I hit the button.

      I think some sort of looping script would be required, but i just can't get my head round it.

      Any help appreciate.

        • 1. Re: Random name generator

          Method 1

          Pull up your students in a found set (perform a find, use Go to Related records...)

          Use Replace field contents and the calculation option with the random function to assign a random number to a number field in the table.

          Sort your records by the value in this number field

          The first record in your found set will be your randomly selected student.


          Method 2

          Use a number field to sequentially number the student records from 1 to 15 (or whatever number of students are in your class)

          Use this expression to generate a random integer from 1 to NumberOfStudents:

          Int ( Random * NumberOfStudents ) + 1

          Either perform a find for this number or use it in a relationship to match to the selected student record.

          • 2. Re: Random name generator

            Thanks PhilModJunk- method 1 worked fine and i have now refined it to show just the name in another layout.


            PS Do you know if FileMaker 12 is able to perform queries on summary fields. 

            • 3. Re: Random name generator

              I have yet to see a copy of FileMaker 12. (If I had received a copy an NDA would prevent me from saying anyway.)

              Queries against summary fields are problematic as the values in them do not refer to specific records and the values they return depend on the current found set and sort order.