How to get a comma seperated list in Crystal

Joe Brown
Joe Brown used Ask the Experts™
on
I have a subreport that is returning 3 results for an item.
RGA#       CC#
100           1
100           2
100           3
101           10
When the results of the customer complaint numbers show on the subreport in the details section, it stacks them vertically. How best would it be for me to have the results of these 3 return as a comma separated array instead?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Consultant
Most Valuable Expert 2011
Top Expert 2013
Commented:
Are these being displayed in the subreport that is in the detail section?

You want to see 100    1,2,3

Assuming you are displaying these from the subreport try this idea

In the subreport header add a formula
Name - DeclareVariables
WhilePrintingRecords;
Global StringVar Array CC_List;
Global NumberVar Num_CCs;
''

Open in new window


In the detail section of the subreport add a formua
Name - BuildList
WhilePrintingRecords;
Global StringVar Array CC_List;
Global NumberVar Num_CCs;

Num_CCs := Num_CCs + 1;
ReDim Preserve CC_List[Num_CCs];
CC_List[Num_CCs] := CStr({CC Field},0,'');
''

Open in new window


In the Subreport report footer add a formula
Name - Display_List
WhilePrintingRecords;
Global StringVar Array CC_List;
Global NumberVar Num_CCs;

Join(CC_List, ', ')

Open in new window


mlmcc
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013
Commented:
Try this

Change the last formula to

IN FOOTER
//{@display}
WhilePrintingRecords;
Global StringVar Array NC_List;
Global NumberVar Num_NCs;

--Join(NC_List, ', ') 
Num_NCs

Open in new window


Does it display a non-0 value?
Joe BrownIT Manager

Author

Commented:
Perfect! Thank you!
Is there also a way to call up a SQL stored procedure instead of having to use three crystal
formulas
Joe BrownIT Manager

Author

Commented:
Thank you for your help!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial