Updating totals for a data grid when data changes

Michael Heilman shared this question 4 years ago
Answered

I have a data grid and separate totals fields. If I create a button off to the side, I can have that button update the total with the sum of a column of numbers in the data grid.


What I cannot get to work, is to have the On Change event of a field in the data grid trigger the update of the total. The way I would like it to work is that if the data in the data grid is edited, the totals recompute automatically. The best I get is that the total gets computed as the value that has just been changed multiplied by the number of rows (instead of the sum of the value in all the rows).

Comments (2)

photo
1

I have figured out how to do this. I have added a datamaster modify event to the on change of the columns and then I re-compute the totals from the datamaster instead of the data grid.

photo
1

This is exactly what I am trying to achieve but for some reason is not updating the dataMaster only the UI side of things. For the totals, if they are getting updated indeed:


sum( filter(DT,CONDITION), numeric field to count)


As soon as I attempt to update the DT with modify(select DT) it stops updating the correct row on the datagrid


Can you share your working logic for this to the community?


I think the examples are very simple in most cases, and that limits the potential of the tool itself.