Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String List using WhilePrintingRecords

Status
Not open for further replies.

rosdancer

Programmer
Jul 26, 2002
14
CA
Hi,

I've only been using Crystal Reports for about a month now.
I would like to display a list of strings, or a concat string that is all the values in a field.
The problem is that I want to display them in the group header not in the details.
I've looked at using a running total but think that whileprintingrecords is my best bet.
I'm not sure how I would do that, what kind of syntax would it be.

Thanks

Roslyn
 
You can insert a linked subreport in the group header and "accumulate" the strings using something like:

Initialize in the subreport header:
---------------------------------
whileprintingrecords;
Global Stringvar gs_result := "";
---------------------------------

Assuming you are concatanating in the detail section of the subreport:
---------------------------------
whileprintingrecords;
Global Stringvar gs_result ;

IF OnLastRecord THEN
gs_result := gs_result + {your_string_field}
ELSE
gs_result := gs_result + {your_string_field} + ", " ;
---------------------------------

Note: In the subreport you want to suppress all sections except the last detail section using a Suppress expression
of:
--------------------
Not OnLastRecord;
--------------------

Note: due to a Crystal limitation, gs_result can grow
only to a length of 254 characters.

hth,
- Ido CUT (Crystal UTilities): e-mailing, exporting, electronic bursting & distribution of Crystal Reports:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top