This is a migrated thread and some comments may be shown as answers.

Grouping aggregates not returning correct counts

1 Answer 60 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 1
Rick asked on 15 Feb 2013, 11:44 PM

Company | Customer  | Invoices

ABC     | Rick      | In1

ABC     | Rick      | In2

ABC     | Rick      | In3

ABC     | Chris     | In4

ABC     | Chris     | In5

CBS     | Dan       | In6

From the data above, if I were to group on the first 2 columns above, I would expect to see

ABC Count:2 (# of customers in company ABC)

--->Rick Count: 3 (# of invoices for customer Rick in company ABC)

--->--->Inv1

--->--->Inv2

--->--->Inv3

--->Chris Count: 2 (# of invoices for customer Chris in company ABC)

--->--->Inv4

--->--->Inv5

CBS Count: 1 (# of customers in company CBS)

--->Dan Count: 1 (# of invoices for customer Dan in company CBS)

--->--->Inv6

Instead, I am seeing that all counts are the number of invoices within the company

ABC Count:6

--->Rick Count: 6

--->--->Inv1

--->--->Inv2

--->--->Inv3

--->Chris Count: 6

ect.

Here's my xaml for the group descriptors and the group header template:

    <telerik:RadGridView.GroupHeaderTemplate>
     <DataTemplate>
      <StackPanel Orientation="Horizontal">
       <telerik:RadButton x:Name="btnSave" Click="btnSave_Click"  Tag="{Binding Group}">
        <StackPanel Orientation="Vertical">
         <Image Source="../images/save.jpg" Height="30" Width="30" HorizontalAlignment="Center"/>
         <TextBlock TextAlignment="Center" TextWrapping="Wrap">Update</TextBlock>
        </StackPanel>
       </telerik:RadButton>
       <TextBlock Text="{Binding Group.Key}" FontSize="14" FontWeight="Bold" TextWrapping="Wrap" VerticalAlignment="Center" Padding="5" />
      </StackPanel>
     </DataTemplate>
    </telerik:RadGridView.GroupHeaderTemplate>
   
    <telerik:RadGridView.GroupDescriptors>
     <telerik:GroupDescriptor Member="Company">  
      <telerik:GroupDescriptor.AggregateFunctions>
       <telerik:CountFunction Caption="Count:"/>
      </telerik:GroupDescriptor.AggregateFunctions> 
     </telerik:GroupDescriptor>
     <telerik:GroupDescriptor Member="Customer">
      <telerik:GroupDescriptor.AggregateFunctions>
       <telerik:CountFunction Caption="Count:"/>
      </telerik:GroupDescriptor.AggregateFunctions> 
     </telerik:GroupDescriptor>
    </telerik:RadGridView.GroupDescriptors>

 

1 Answer, 1 is accepted

Sort by
0
Rick
Top achievements
Rank 1
answered on 25 Feb 2013, 01:05 PM
Can anyone answer this
Tags
GridView
Asked by
Rick
Top achievements
Rank 1
Answers by
Rick
Top achievements
Rank 1
Share this question
or