I am setting up a grid form and would like to keep a running balance after each transaction. It should look like this:
ID Date Income Expense Balance
1 3/17/15 $100 0 $100
2 3/18/15 $50 0 $150
3 3/18/15 0 $75 $75
4 3/19/15 0 $25 $50
I was able to create run sql statement to do this but I am not sure how to apply it in Scriptcase:
select id, date, expense O.income
,(select sum(income) - sum(expense) from ledger
where id <= O.id)
‘Balance’
from ledger O
Is this the best way? Can I calculate with onRecord?
Any help is greatly appreciated!