3 Replies Latest reply on Feb 18, 2015 4:06 PM by philmodjunk

    Sorting records into groups

    JaneFlower

      Title

      Sorting records into groups

      Post

      Hi,

      My database manages attendees at camp for teens.  I need to breakdown all the attendees into groups of 7 or 8 and mix them up so there’s even distribution of boys and girls, a good mix of ages and ensure that people from the same places aren’t likely to be in the same group.

      Is it possible to create a script, or some other type of sorting mechanism, that will create randomised lists based on this criteria?  If so, how would I start constructing it – for example, what functions should I look into?

      Many thanks.

        • 1. Re: Sorting records into groups
          philmodjunk

          You'll have to decide what you really want here. "Mixing them up so that there's an even distribution..." is not a randomised list, it's a list structured according to very specific and complex criteria.

          A purely randomized list is quite simple to do in FileMaker if you use the random function to assign a random number to each record, you can sort your records on that field to get a random order.

          • 2. Re: Sorting records into groups
            JaneFlower

            My apologies, poor choice of wording.  The big part I’m having trouble getting to grips with is can you get output from Filemaker to put records in groupings of a specific number?  So produce a script to say “sort records by this criteria” then . . . . ?  Can you create a script that will say for every X number of records write a particular field, then sort by that field to get a list of names?

            • 3. Re: Sorting records into groups
              philmodjunk

              Yes it is possible, might not need anything more than a replace field contents operation with a calculation that works like this:

              Ceiling ( Get ( RecordNumber ) / 5 )

              This would put a 1 into a field of the first 5 records, a 2 into the next five, 3 into the next five and so forth....

              The functions that I am using can be looked up in FileMaker help if they are unfamiliar.