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

Summarizing problem 1

Status
Not open for further replies.

mikkom

Technical User
Jul 23, 2010
29
FI
I need to calculate the age distribution of warehouse. I made a formula which shows stock value if there is no events for stock item in five years.

{@sum}
if ({@year} < ({?year}-4)
and (sum ({@stock_event}, {@year}) > 0))
then {stock.value}
else 0

But I also need total stock value of stock items more than five years old. And crystal don't summarize formula {@sum}. How I can't summarize it?
 
You can use a variable to sum your formula {@sum}:

Place the following formula in the same section where your {@sum} is located:

whileprintingrecords;
numbervar tot := tot + {@sum};

In the report footer, show the result using this formula:

whileprintingrecords;
numbervar tot;

if {@sum} is a currency, change "numbervar" to "currencyvar" in both formulas. If you are trying to sum at a group level, place the second formula in the group footer, and add a reset formula in the group header:

whileprintingrecords;
numbervar tot;
if not inrepeatedgroupheader then
tot := 0;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top