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!

Refering back to values from report footer 1

Status
Not open for further replies.

SouthwestNut

Programmer
Sep 10, 2001
35
0
0
US
I am developing a footer that makes use of CAGR's (cumulative annual growth rate). What I would like to do is refer back to the values in the detail part of the report to build my CAGR formula.

Example

2002 180
2003 198
2004 212
2005 225
2006 295

So a CAGR takes the difference between 2006 and 2005 and divides it by 2006. (70/295) Then to go to multiple years back the formulas gets more challenging. However, I would like to refer back to individual values in the report footer instead of having to write a different subreport to handle the calculations.

Thanks in advance
 
No idea why you'd need a subreport in either case.

Consider storing the values in arrays within a formula in the details section and use them later:

whileprintingrecords;
numbervar array years;
numbervar array values;
numbervar array cagr;
redim preserve years(recordnumber);
redim preserve values(recordnumber);
redim preserve cagr(recordnumber);
years[recordnumber] := {table.year};
values[recordnumber] := {table.value};
values[cagr] := ({table.value}-previous({table.value}))/{table.value};

Now you can build out a display formula for each in the report footer:

whileprintingrecords;
numbervar array years;
join(years,chr(13))

whileprintingrecords;
numbervar array values;
join(values,chr(13))

whileprintingrecords;
numbervar array cagr;
join(cagr,chr(13))

Place the above display formulas alongside each other in the report footer.

-k
 
One thing(workaround) I did was to add a number of formulas that said "If Year = 2003 Then Sales" with a name of Alias1

Then in the report footer I write Sum(Alias1) and it works fine. Its not as intuitive as I would like, but I was able to develop my cumulative growth rates for 1,2 and 3 years fairly easily.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top