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!

Setup Views for Collecting Running Totals on Unique Fields

Status
Not open for further replies.

TheLibrary

Programmer
Nov 19, 2003
37
US
Crystal 9
Having trouble setting up a View to create a table where I can store "running totals" for specific field data.

I have a date received, part number and qty received (Date, Part, Qty).

I must sort by date but I want to show a running total of qty recieved:

Date Part No. Qty SumTotal
1-10-04 7530-09 20 20
1-10-04 7690-77 10 10
1-11-04 7530-09 20 40
1-13-04 6789-33 25 25
1-13-04 7690-77 12 22
1-14-04 7530-09 15 55

Stored procedure doesn't help since I want to include other data sources.

Specific help is requested, or reference to posted FAQ's.

Thanks,
Gerry
 
Views don't create tables, and Crystal is a horrible place to generate data from.

A Stored Procedure could work, but it doesn't make sense based on what your showing.

From what I see, you just want to show the running totals by date, so write a subreport that is linked by part number and date, and return the sum in a shared variable.

Before you run the subreport reset the value in a formula;
Main report reset formula:
whileprintingrecords;
shared numbervar CurrDatePartQty:= 0;

subreport formula:
whileprintingrecords;
shared numbervar CurrDatePartQty:= sum({table.qty});

Run the subreport at the detail level before you use the display formula in the main:

Main report formula to display:
whileprintingrecords;
shared numbervar CurrDatePartQty

It'll be kind of slow, but it'll work.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top