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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group By

Status
Not open for further replies.

tweetyng

MIS
Feb 23, 2006
46
US
Could you please help with this question? can I add these records to only one line with group by patient_no such as:


Patient_no RX Meds dose

1252 INH 600 mg
1252 RIF 800 mg
1252 B6 50 mg
1252 EMB 1250 EA

I would like to show on the report only one line such as:

Patient_No Meds
1252 INH 600mg, RIF 800mg, B6 50mg, EMB 1250mg

Thanks
 
Group on Patient_No

Reset a global stringVar to "" in a GH1 formula
Append to the string variable in a detail formula
Remove the last ", " in the string variable and display its content in a GF1 formula.

- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Thanks for your reply IdoMillet. However, I don't quite understand much what you said. Could you please explain more detail on this one. Thanks
 
Here's something similar I did for collecting postcodes.

Code:
// Accumulate using a formula field (suppressed) in the detail line.  Allow for nulls and blanks.
whileprintingrecords;
if not isnull({Recc.Postcode}) and {Recc.Postcode} <> " "
then stringvar pst := pst + {Recc.Postcode} +", "
else if length(pst) = 0 
then stringvar pst := pst + "Excluding blanks; "
else stringvar pst := pst

Code:
// Show in using a formula field in the group footer.
whileprintingrecords;
stringvar pst;
left(pst,len(pst)-2)

Code:
//  Clear using a formula field using in the group header.
whileprintingrecords;
stringvar pst := "";

Note that clearing in the footer avoids problems with group headers repeating on a new page, which does clear everything for the group. Provided the 'clear' is placed in the section AFTER the display, it will do them in that order.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thanks Madawc Williams. It worked. Thanks for millions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top