You can use the listchoices( function to list the values in the field you used for grouping. Then you would go into a loop. The loop would step through the list, selecting the records with the current value in the appropriate field, and “printing” the pdf.