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!

Total with concatenated details

Status
Not open for further replies.

mfenn

IS-IT--Management
Sep 6, 2008
22
US
Hi there,
I found a post to tell me out to concatenate message code fields, which works great. But now I am having a problem with summary totals for detail lines that have more than 1 message code on a line. If the line does not have a message or only has 1 message the total is fine, but the dollar amount for a line that has 2 or more message codes is multiplied by how many codes there are. example a detail line with 3 concatenated messages has that dollar amount added into the total 3 times.

Here are the formulas:
GH
Code:
whileprintingrecords;
global stringvar strClmeCodes := "";

Details
Code:
whileprintingrecords;
if global stringvar strClmeCodes = "" then 
  global stringvar strClmeCodes := {p011e_csv.Event_Code}     
else
  if global stringvar strClmeCodes <> {p011e_csv.Event_Code} then
    global stringvar strClmeCodes := strClmeCodes + ", " + {p011e_csv.Event_Code}

GF2 (displays data based on claim id field)
Date line message Charge
2/28/08 1 50.00
2/28/08 2 O8, O16 850.00
GF1 (displays total based on dollar field)
Total 1750.00

Any ideas on how to fix this would be appreciated.
Many thanks,
mfenn
 
If the line numbers are data fields, try using running totals with a formula test to decide whether to add or not.

If you're not already familiar with Crystal's automated totals, see FAQ767-6524.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Hi,

I'm still pretty new to Crystal. I am using Crystal 8.5 currently.

Running total does work for this but since there are a lot of subtotals and grand totals I would rather figure out what is wrong with the concatenation.

If I a service line with 3 messages my concatenation (hidden) looks like:
21
21,28
21,28,B4

and my display looks like:

Service line $20 21,28,B4
Sub total $60
Grand total $60

If I move the concatenation up to a header then I only get the first message, but the totals work.

Do I need to put it in a subreport to only display the final concatenation?

I have attached an example of what I'm working with, hopefully you can read it.
 
 http://www.box.net/shared/o6eh5a7ymd
The whileprintingrecords in your formula means it only happens while the details are printing. So you have the details in the footer but not the header.

Running totals follow the same rule. Yes, you may have to use a subreport to get what you want.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You DO need to use a running total, since you want to sum the amount only on change of group #2. So insert a running total that does a sum of amount, evaluate on change of Group #2, reset on change of Group #1. For the grand total, create a second running total just like the first, but change the reset to never.

-LB
 
Thanks LB and Madawc,
The running totals did work for this project. Appreciate the help.

mfenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top