Using the previous() function seems like it would be an obvious choice for this solution, but since the formulas cannot refer to each other cyclically (ie {@CurrentBalance} cannot refer to {@PreviousBalance} versa), and they cannot be recursive, they are more difficult to implement it in such a way than it seems first.
Instead, you should use a variable to track the balance between transactions. You can do this by creating 3 formulas and placing them in the appropriate sections of your report.
// {@initVars} - Initialize balance variable //This formula should be placed in your report header whileprintingrecords; numbervar balance:=0 // {@previousBalance} - Display previous line balance //This formula should be placed in your Details section whileprintingrecords; numbervar balance; // {@currentBalance} - Display current balance after transactions //This formula should be placed in your Details section evaluateafter({@previousBalance}); numbervar balance := balance + {table.LoanAmount} - {table.CollectionAmount}
source share