## Unanswered: Formula Problem in CR10Pro

Hi,

I am hoping someone else has seen this problem....

I have a report with a formula in the details section. The grouping for the GrpFooter in "Specified Order".

snip of the formula is:

// Need to develop formula to take into account when report is ran vs. what period they want
// the prorated portion to be based on.

// Since this formula is in the Detail section, amounts are not SUM'd or SUM'd by groups either!!!

Shared numberVar passcount;

Shared numberVar TotCapExpSub ;
Shared stringVar proratedPeriod ;
Global stringVar array OnePayPerYr;
Global stringVar array TwoPayPerYr;
Global stringVar array FourPayPerYr;

IF proratedPeriod = "1" then (

99999999

)else

IF proratedPeriod = "2" then (

999999999
)else

IF proratedPeriod = "3" then (

999999999
)else

IF proratedPeriod = "4" then (

9999999999
)else

IF proratedPeriod = "5" then (

99999999999
)else

IF proratedPeriod = "6" then (

passcount := passcount + 1;
TotCapExpSub := TotCapExpSub +
// nested IIF to handle the debt that is only paid 1,2 or 4 times per yr
IF {GLMasterCurrent.ClassificationAccountId} in OnePayPerYr then(
({GLMasterCurrent.BalanceFwdActual}) +
({GLMasterCurrent.YTDActual})
)
else
IF {GLMasterCurrent.ClassificationAccountId} in TwoPayPerYr then (
(({GLMasterCurrent.BalanceFwdActual}) +
({GLMasterCurrent.YTDActual})) * 2
)
else
IF {GLMasterCurrent.ClassificationAccountId} in FourPayPerYr then (
(({GLMasterCurrent.BalanceFwdActual}) +
({GLMasterCurrent.YTDActual})) * 2
)
else

(({GLMasterCurrent.BalanceFwdActual}) +
({GLMasterCurrent.YTDActual}) -
({GLMasterCurrent.ActualPer07}) -
({GLMasterCurrent.ActualPer08}) -
({GLMasterCurrent.ActualPer09}) -
({GLMasterCurrent.ActualPer10}) -
({GLMasterCurrent.ActualPer11}) -
({GLMasterCurrent.ActualPer12})) / 6 * 12

)else

IF proratedPeriod = "7" then (

99999999
)else

IF proratedPeriod = "8" then (

999999999999
)else

IF proratedPeriod = "9" then (

TotCapExpSub := TotCapExpSub +

IF {GLMasterCurrent.ClassificationAccountId} in OnePayPerYr then(
({GLMasterCurrent.BalanceFwdActual}) +
({GLMasterCurrent.YTDActual}) )
else
IF {GLMasterCurrent.ClassificationAccountId} in TwoPayPerYr then(
({GLMasterCurrent.BalanceFwdActual}) +
({GLMasterCurrent.TotBudRevsn}) * 2 )
else
IF {GLMasterCurrent.ClassificationAccountId} in FourPayPerYr then(
({GLMasterCurrent.BalanceFwdActual}) +
({GLMasterCurrent.YTDActual}) * 4 )
else
( {GLMasterCurrent.BalanceFwdActual} +
{GLMasterCurrent.YTDActual} -
{GLMasterCurrent.ActualPer10} -
{GLMasterCurrent.ActualPer11} -
{GLMasterCurrent.ActualPer12}) / 9 * 12

)else

IF proratedPeriod = "10" then (

999999999
)else

IF proratedPeriod = "11" then (

9999999
)else

IF proratedPeriod = "12" then (

TotCapExpSub := TotCapExpSub +
// nested IIF to handle the debt that is only paid 1,2 or 4 times per yr
IF {GLMasterCurrent.ClassificationAccountId} in OnePayPerYr then(
{GLMasterCurrent.BalanceFwdActual} +
{GLMasterCurrent.YTDActual} )
else
IF {GLMasterCurrent.ClassificationAccountId} in TwoPayPerYr then(
{GLMasterCurrent.BalanceFwdActual} +
{GLMasterCurrent.YTDActual} )
else
IF {GLMasterCurrent.ClassificationAccountId} in FourPayPerYr then(
{GLMasterCurrent.BalanceFwdActual} +
{GLMasterCurrent.YTDActual} )
else

{GLMasterCurrent.BalanceFwdActual} +
{GLMasterCurrent.YTDActual}
// For December Actuals are not prorated, probably never used but included here
)

Note: I took out the code for periods I am not concerned with at this time to debug... thats where the "999999999999" come from...

So as you can see, I am accumulating the TotCapExpSub variable and I just display that in the group footer and I hide the detail section.

My problem is it makes an extra pass through the detail section after the last row has been pulled. So the total is off by the amount of the last real row in the result set for that subreport.

I do not see why it is doing this @!\$#%#\$^\$%

Any ideas?

I added a counter to see if it was really doing what I suspected and it is !

TIA,

Don
dboling02@yahoo.com