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

Merging Fields in Crystal rerports

Status
Not open for further replies.

Slimsteve

Technical User
Jun 10, 2003
67
GB

Hi,

I do not know if this possible in crystal reports, but I will ask it anyway.

Bascially I am writing a report template for a accounts system, at the moment the data I get in the report looks as follows

Card £10.00
Cheque £5.00
Voucher £5.00

The data is grouped by Payment Type i.e. card, cheque, voucher etc.

What I would like to do is to present this data in the following format on the report, so that it will fit the allocated space on the printout (preferably a single string output).

Card £10.00, Cheque £5.00, Voucher £5.00

Does anyone know if this is possible ?

Thanks

Slim
 
There are different ways you might do this, depending upon your version of Crystal (please include technical inforamtion when requesting it).

Perhaps the simplest is to right click the details and select format with multiple columns and adjust the width to your needs using the new tab.

-k
 

Hi,

I forgot to mention that I am using Crystal reports 9.

The values are currently stored in the details section of my report and are created by a sum function (sum({Payalloc.Amount},{PayDetails.Description})).

I have already tried the format with multiple columns option, but the users would prefer there not to be gaps in the string displayed (as some of the payment details are longer than others for example "Voucher £10.00").

So what I am really asking is, can I get the values in the same format as doing the format with multiple columns, but with out the varying size of gaps between each one (i.e. trim the space out).

Hope this makes sense.

Slim
 
You could accumulate the values using the following formulas:

//{@accum} to be placed in the group (Payment Type) header or footer:
whileprintingrecords;
stringvar accum := accum + {table.paytype} + " " + totext(Sum ({Payalloc.Amount},{PayDetails.Description})) + ", ";

//{@display} to be placed in the report footer (or the footer of a higher order group (like Account}:
whileprintingrecords;
stringvar accum;
if ubound(split(accum,", ")) > 1 then
left(accum, len(accum)-2) else
accum;

If you do have a higher order group, you would need a reset formula:

//{@reset} to be placed in the higher order group header:
whileprintingrecrods;
stringvar accum := "";

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top