To simply that a bit, you could do this:
//{@reset}-- if you want the comma-delimited result per some group, place this in the group header:
whileprintingrecords;
stringvar x;
if not inrepeatedgroupheader then
x := "";
//{@accum} to be placed in the detail section:
whileprintingrecords;
stringvar x := x + {table.medication}+",";
//{@display} for the group footer (or report footer if no group):
whileprintingrecords;
stringvar x;
if len(x)>1 then
left(x,len(x)-1)
-LB