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

Sum of Group Summary 1

Status
Not open for further replies.

idd

Programmer
Apr 19, 2002
165
GB
Hi,

I'm using CR 9

I have created a manual Cross tab sort of report.

I shall explain the report first then explain what I require.

My report is set out as below:

GH1 User Initials
GH2 Payment Type
GH3 Invoice Ref
Detail Invoice and payment Details (Suppresed with Drill Down)
Detail Invoice and Payment Details. (Suppresed with Drill Down)
GF3 (has summaries of details, built with many formulae) *
GF2
GF1

* There are multiple product codes which could be used in the details of the invoice lines, so GF3 is used to indicate the sums of these amounts, by splitting the payment purpose into the various charges.

i.e.

GH3 and GF3 would like this

GH3
INV_Ref | Fullname | Product | Inv_Gross Total | $ Paid | @mem | @Events |

GF3
has the data relating to the above.

@mem is a formula to extract the various charges on an invoice and is shown below.

if product.prod = "Membership" then tonumber({InvLine.INVLN_UNIT_PRICE})

there are another 9 formulas like @mem for each of the different payment areas.

I then would like these summed up in a sub total for the payment type shown in GH2 or GF2 I have done this part of the report.

The problem area is the Payment_amount figure which is shown on the detail lines, if I place this in GH3 as well there is no problem so far, I then add a summary to add to GH2 as sum of Pay_amount,

When I try to do this though what it ends up doing is summing up all the detail lines as pay_amount is on each of the detail lines.

Can someone help figure this one out.

so to sum it up(no pun intended) I need the details for pay_amount in GH3 once for each invoice followed by a sum of these Pay_Amounts in GH2/GF2.
 
Create three formulas:

//{@reset} to be placed in the GH2:
whileprintingrecords;
numbervar payamt;
if not inrepeatedgroupheader then
payamt := 0;

//{@accum} to be placed in the GF#3:
whileprintingrecords;
numbervar payamt := payamt + {table.pay_amount};

//{@display} to be placed in the GF#2:
whileprintingrecords;
numbervar payamt;

-LB
 
LBass,

I just thought it would be you who replies, Thanks for the response, I will try this tomorrow when I am at work.

I'm fairly new to Crystal, so will require things written so that a newbie can understand.

In the first formula is that

if not {repeatedGroupHeader} then

or is that that

If not in {repeatedGroupHeader}

Thanks once again will try this tomorrow

Idd

 
It is exactly as I wrote--all run together like that.

-LB
 
LBass,

Thanks for the help, it worked a treat.

I would never have known that inrepeatedgroupheader was a reserved word.
Only when I came to work today and typed it in Crystal and the text turned blue did I realise.

Could this have been done with Grand totals or summaries, or is there really no way of doing these things without resorting to the technique you gave above.

Idd


 
Actually you could have inserted a running total that did a sum of {table.payamount}, evaluate on change of group #3, reset on change of group #2. This is the essentially the same as the manual running total I suggested earlier. Because of the repeating value of payamount in the detail section, you can't use inserted summaries.

-LB
 
Thanks for the clarification.

Idd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top