Hi
I am looking to write a custom aggregate that sums a column but excludes certain rows.
On this grid there are 2 groups applied. I have the sum working for the first level of groups but not the total of the second group level or the total of the whole grid
They just seem to show the values of the row above
Any ideas?
Private Sub grid_CustomAggregate(sender As Object, e As GridCustomAggregateEventArgs)
Dim total As Decimal = 0
if TypeOf (e.item) is GridGroupFooterItem then
If TryCast(e.Column, GridBoundColumn).DataType = GetType(Decimal) Then
For Each groupHeader As GridGroupHeaderItem In _grid.MasterTableView.GetItems(GridItemType.GroupHeader)
Dim children As GridItem() = groupHeader.GetChildItems()
total = 0
For Each gridDataItem As GridItem In children
Dim item As GridDataItem = TryCast(gridDataItem, GridDataItem)
If TypeOf (item) Is GridDataItem Then
If item("exclude").Text <> "True" Then
total = total + CDec(item(e.Column.UniqueName).Text)
End If
End If
Next
Next
End If
End If
e.Result = total
End Sub