PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Running Balance on a table control
Running Balance on a table control
Iniciado por guest, 17,nov. 2017 23:05 - 2 respuestas
Publicado el 17,noviembre 2017 - 23:05
I need to create a table control similar to a check register where
the table displays/calculates a running balance like this:

Date Description Deposit Payment Balance
01/01/01 Beg Balance 3000.00 3000.00
01/02/01 Sears 250.00 2750.00
01/03/01 DayCare 325.99 2424.01
01/04/01 Deposit 2500.00 4924.01

IS this possible in a WinDev Table Control?

THNX !!
Joe Maldo
Publicado el 17,noviembre 2017 - 23:28
Hello Joe

You could make use of hidden columns and either the "ExitFrom" or "WhenEverModify event for the table cell containing the item value. You would also need to either remove the sort options on the table or maintain a hidden or exposed item sequence number to work through the rows in the correct order.

Presumably the table is quite short and in memory ?
When a value changes, cycle through the table in row order, calculating and holding that rows total and using it to calculate the subsequent rows running balance as you go. Perhaps not the most efficient but it will update the current row and any subsequent rows. A more efficient method would be to capture the previous row's total using the table row exit event and then just updating subsequent rows rather than the whole table.

Regards
Al
Publicado el 18,noviembre 2017 - 04:10
AL,
Thank you very much.
I had not thought of using this approach!

Regards,
Joe Maldo