I would do it this way:
I will do it for a patient with a max of 4 meds....you can modify it to have more easily by adding more variables and sections
in the patient name Group header place the following formula
@Initialization (suppressed)
WhilePrintingRecords;
if not inrepeatedgroupheader then
( stringvar array patient := ("","","",""

;
stringvar array medicine := ("","","",""

;
stringvar array quantity := ("","","",""

;
stringvar array refills := ("","","",""

;
numbervar medcounter := 0;
);
There should be only one more group and that is by medicine type.
now in the detail section place the following
@assignment
WhilePrintingRecords;
stringvar array patient ;
stringvar array medicine ;
stringvar array quantity ;
stringvar array refills ;
numbervar medcounter ;
medcounter := medcounter + 1;
patient(medcounter) := {table.patient};
medicine(medcounter) := {table.medicine};
quantity(medcounter) := totext({table.quantity},0};
refills(medcounter) := totext({table.refills},0};
All groups, footers and detail sections are suppressed except for the Patient Footer
Make this into 2 sections
create 4 formulas similar to the following:
@Display Med1
WhilePrintingRecords;
stringvar array patient ;
stringvar array medicine ;
stringvar array quantity ;
stringvar array refills ;
"Patient: " + patient(1) + chr(13) + chr(10) +
"Medicine: " + medicine(1) + chr(13) + chr(10) +
"Quantity: " + quantity(1) + chr(13) + chr(10) +
"Refills: " + refills(1) ;
Place the first 2 in the first footer section and the second 2 in the next section....make sure the "Can grow" is enabled for each formula.
In the conditional suppress for each formula place the formula
Patient(1) = "" //(of course you would change the array
element with the formula)
In the second footer section enable the "suppress blank section).
This is a label type report as SV suggested...I just filled in details
Hope this helps
Jim Broadbent