So im working on a side project for a canine agility database application.

Essentially I am creating for an agility venue a way to score an agility trial, and automatically generate a number of reports.

One report is called the gate sheet (it's the running order of the dogs split by jump height class). Some people who enter the trial have more than one dog they are running that day in the same class. The logic for what I want to generate goes something like this:

If handler ID is the same put 6 entrants between runs or move to end.

For example lets say Stacy has 3 dogs all running in the 20" height class, I want the gate sheet report to automatically print like the following:
...
20" Height Class
Stacy - Spot
Jack - Rover
Richard - Fido
Jill - Scooby
Paul - Snoopy
Meghan - Lassie
Melanie - Stuart Little
Stacy - Pluto
Patrick - Ajax
Hugh - Falton
Stacy - Goofy

22" Height Class
...
What are some ideas of how I could split it up. Each entrant has a handler ID so I should be able to check if handler ID is the same and tell the report to insert a number of entrants between handler numbers, but can't for the life of me figure it out!

Thanks in advance!