I can think of a way to do this. Not sure if is the best. Group the report by Piece_Id. Create three formulas. The first one would define a shared StringVar and set it to "" (example: shared stringvar defect_cd := "";). The second one (of course would have the shared stringvar, the same as the first formula) which would be in the detail section, would have a line something like this: defect_cd := defect_cd & ", " & {defect_code}.
The third formula would be in the group footer and it just would have the same shared variable defined and the same shared variable name (example:
shared stringvar defect_cd;
defect_cd;
I hope this helps