I have a typedlist that I want to group by every field except one, and sum() one column. It just doesn't seem to be doing the group by or sum .It's displaying every record individually. I've added sorting to it and it's sorting by the column I need, but no group by or aggregate sum. Any idea? I also selected i wanted the fields(7) sum
' __LLBLGENPRO_USER_CODE_REGION_START CustomTypedListCode
Public Function GetRows(ByVal Category As String) As AadetailStandingTypedList
Dim MyAADetailStanding As New AadetailStandingTypedList
Dim Sorter As New SortExpression()
Dim Filter As New PredicateExpression
Dim fields As IEntityFields = MyAADetailStanding.BuildResultset()
Dim groupByClause As IGroupByCollection = New GroupByCollection()
Dim dao As New TypedListDAO()
Sorter.Add(New SortClause(fields(7), SortOperator.Descending))
fields(7).AggregateFunctionToApply = AggregateFunction.Sum
groupByClause.Add(fields(0))
groupByClause.Add(fields(1))
groupByClause.Add(fields(2))
groupByClause.Add(fields(3))
groupByClause.Add(fields(4))
groupByClause.Add(fields(5))
groupByClause.Add(fields(6))
groupByClause.Add(fields(8) )
Select Case Category
Case "W"
Filter.Add(PredicateFactory.CompareValue(AADetailFieldIndex.Gender, ComparisonOperator.Equal, 1))
Case Else
Filter.Add(PredicateFactory.CompareValue(AADetailFieldIndex.SpecCategory, ComparisonOperator.Equal, Category))
End Select
groupByClause.HavingClause = Filter
dao.GetMultiAsDataTable(fields, MyAADetailStanding, 0, Sorter, Nothing, MyAADetailStanding.BuildRelationSet(), True, groupByClause, Nothing, 0, 0)
GetRows = MyAADetailStanding
End Function
Any Ideas?
Thanks
Bobby B.