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

Group total/running total 1

Status
Not open for further replies.

rjcmbc

MIS
Jun 4, 2004
6
CA
I am trying to obtain a total a running total field for each group which is a different date and need to reset this running total at the start of the new Group/date. Any help would be appreciated! Thanks.
 
For better results, try posting technical information:

Crystal version
Database used
Example data
Expected output

You might proofread your posts as well, this is unclear: "I am trying to obtain a total a running total field for each group"

Are you stating that you're trying to total a running total?

To perform summary functions in most versions of Crystal for a given group, you would create the group (Insert->Group->Select the date field), and then drop the field that you want to total into the details, right click it and select insert->summary->sum.

You might also select insert grand total if need be at the same time.

Hope this gets you closer.

-k
 
Sorry about being unclear I was in a bit of a rush.

As for the version it is Crystal 9.

As for the total on the running total field it cannot be summarized it is already summarizing another field I have on the report thus I don't get the 'Insert' option for this running total field.

I am trying to create a reset field using a variable at the top of the new date/group page and have the running total start calculating again (from 0) for this date/group. However this isn't working. Is this a bit more clear? Thanks.
 
It sounds like you are trying to create a manual running total, so you would use three formulas:

//{@reset} to be placed in the Group 1 (Date) header:
whileprintingrecords;
numbervar grpsum := 0;

//{@accum} to be placed in the group 2 header or footer:
whileprintingrecords;
numbervar grpsum := grpsum + sum({table.amt},{table.group2field});

//{@display} to be placed in the group 1 (Date) footer:
whileprintingrecords;
numbervar grpsum;

Since you said you were trying to summarize a summary, I assumed the summary was for an inner group (e.g., on {table.group2field}). Substitute your own summary for sum({table.amt},{table.group2field}).

If this isn't what you are looking for, please share your formulas and explain in what sections you are placing them.

-LB
 
Thanks LB, you guided me in the right direction...

I had to add another line of code to add at the @reset level to make it work however due to the report:

whileprintingrecords;
//reset to 0 only on date/group change
if previous({table.date})<>{table.date} then
numbervar grpsum:= 0;

Now it works like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top