水晶报告累计平衡首次失踪记录

时间:2014-02-13 17:13:15

标签: crystal-reports crystal-reports-2010

enter image description here

我在UnboundNumber(累计余额)中使用了以下公式,但是蓝色圆圈字段缺失并且出现错误:

If Next({SP_Aging;1.AHead}) = Previous ({SP_Aging;1.AHead}) Then 
  numberVar X := (X +  {SP_Aging;1.Balance} )

Else
  X := 0 +{SP_Aging;1.Balance}

;

1 个答案:

答案 0 :(得分:1)

尝试:

// {@Accumulated Balance}

// declare variable; mark as `global` to be explicit (w/o this, the variable is `global`, but this makes it clearer)
Global Numbervar balance;

// if this is the first row, increment the balance; always test for NULL values first in CR
If PreviousIsNull({SP_Aging;1.AHead}) Then

  balance := {SP_Aging;1.Balance}

// if the current row's AHead is the same as previous row's value, increment balance
Else If {SP_Aging;1.AHead} = Previous({SP_Aging;1.AHead}) Then 

  balance := balance + {SP_Aging;1.Balance}

// otherwise, reset
Else

  balance := {SP_Aging;1.Balance}