Sum is great for getting the sum of the entire column. But what I am looking for is creating a running balance showing the accumulated sum for each item.
It’s like a check register: you have the Open Balance at the top and for each check or deposit the balance column shows the balance after each transaction.
Using arrays it’s something like:
So there are two issues:
- if I’m using an entity selection how do I add the column for the balance column?
- a listbox column and formula?
- add a property to each record?
- something else?
- how to deal with the getting the value from the prior element?
The best approach I’ve come up with is to loop the entity selection and create a display collection where each element of the collection is an object containing the record reference and a balance property:
$sum:=0 // or the opening balance
End for each
This works OK. I can still reference the entity directly and I’ve got a purely memory based property, “balance” that I can adjust any way I want.
It just seems a bit clunky and I feel like I’m locked into thinking about it from my old perspective.