Hi
Please can you tell me the best/easiest way to manually calculate aggregate fields in a grouped grid. I need to be able to reset the variable storing my running total when the grid group has changed. I don't know what is the easiest way to detect if a group has changed. Also the code i use should not crash if the grid is not grouped because the code will be present inside a function which will be called by grids that may or may not be grouped
This was the best i could think of
thanks
Please can you tell me the best/easiest way to manually calculate aggregate fields in a grouped grid. I need to be able to reset the variable storing my running total when the grid group has changed. I don't know what is the easiest way to detect if a group has changed. Also the code i use should not crash if the grid is not grouped because the code will be present inside a function which will be called by grids that may or may not be grouped
This was the best i could think of
| dim groupIndex as integer = 0 |
| dim runningTotal as integer = 0 |
| In item data bound event |
| if e.item.OwnerTableView.groupExpressions = 0 'no grouping |
| runningTotalrunningTotal = runningTotal + column value |
| else 'grid is grouped |
| if grid.groupIndex = groupIndex then 'same group as last time |
| runningTotalrunningTotal = runningTotal + column value |
| else 'group changed groupIndex = grid.groupIndex |
| runningTotal = column value |
| end if |