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

Need a formula that combines rows

Status
Not open for further replies.

Ruune

Programmer
Jun 7, 2006
33
US
I've written a report that pulls active pharmacy orders for a given patient, which is exactly what my end users (doctors) need. However, they want to be able to right-click on a single field and copy all the data for a given patient.

So far, I've got the report sorted by patient and have combined the columns in the report into one, using the following formula:
{history_client_order.order_description} + ", " + {history_client_order.dosage} + ", " + {history_client_order.frequency_description} + ", " + totext({history_client_order.start_date}) + ", " + {history_client_order.ordering_pract_name} + chr(13)

Basically, I intended that formula to create one large field, with a line break at the end of each line- so that they could copy all the data in a given group's details and paste directly to their client application.

Also, exporting to an xls or doc is out of the question because its "too complex a procedure" (read: they're too lazy to do it).
 
Do you group by patient? If not, that's the first step. You can also specify that the whole of a group will appear on the same page. Exactly how depends on your Crystal version, which you should have given to get the best answers. But basically it is right-click on a group section and "Change Group"

Take a look at 'drill down' - you suppress some details on the report, but if the user clicks on the account number, they get the extra details in an extra little report.

If you're using Crystal 8.5 you'll find limits on the amount of text in a Formula Field. Not with 9 or above.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I think using either drilldown or an on-demand subreport would address your needs.

-LB
 
I still get separate rows in the details. I need to combine all the rows into one copyable field... like a large text box, with a line break inside the field where the end of each row would normally be.

...and I'm using crystal 10.
 
So what is the problem you are running into with the formula you tried?

-LB
 
Sorry, I guess the issue is that you have multiple records. Try using three formulas:

//{@reset} to be placed in the patient group header:
whileprintingrecords;
stringvar x := "";

//{@accum} to be placed in the detail section:
whileprintingrecords;
stringvar x;

x := x + {history_client_order.order_description} + ", " + {history_client_order.dosage} + ", " + {history_client_order.frequency_description} + ", " + totext({history_client_order.start_date}) + ", " + {history_client_order.ordering_pract_name} + chr(13);

Then in the patient group footer use:
//{@display}:
whileprintingrecords;
stringvar x;

Be sure to format {@display} to "can grow" (format field->common->can grow).

-LB
 
awesome... that did it! thanks LB!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top