2014-02-13 64 views
0

enter image description hereCystal報告累計餘額首次記錄缺少

我用下面的公式在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

嘗試:

// {@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}