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

GetAggregateResult

3 Answers 109 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Sheuly
Top achievements
Rank 1
Sheuly asked on 28 Apr 2014, 02:19 PM
Hi,
Could you provide some example on how to get cell aggregate value, I have tied the following code with no success:
  IPivotResults results = RadPivotGrid1.DataProvider.Results;
  AggregateValue aValue = results.GetAggregateResult(0, GridControl.RadPivotGrid.RowGroups[0], GridControl.RadPivotGrid.ColumnGroups[0]);
 
GetAggregateResult(...) returns null.

Thanks.

Sheuly

3 Answers, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 29 Apr 2014, 10:48 PM
Hi Sheuly,

May I ask you for more details what would you like to achieve - why do you need the aggregated results? The problems with the code you've tried is that RowGroup[0] and ColumnGroup[0] are of type GroupNode and they don't match with the types used when calculating the results (GroupNode inherits IGroup and it is the ViewModel for the data shown in RadPivotGrid).

If you can share more details on your scenario, we'll be glad to assist you further in order to achieve your goal. I'm looking forward to hearing from you.

Regards,
Rosen Vladimirov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Sheuly
Top achievements
Rank 1
answered on 30 Apr 2014, 07:14 AM
Hi,
I want to export the grid as collapsed mode(kind of what you see what you get ). If the grid is collapsed to top level then it should be exported as it is. As the GenerateExport() method in RadPivotGrid returns PivotExportModel which contains all cells regardless
of expanded or collapsed, so I need to read the cell value for each column and row groups.This way, I can do the export by not using the GenerateExport(). My understanding was using of GetAggregateResult to get the cell value, not sure though if it’s the right way to do.

Thanks.
Sheuly
0
Rosen Vladimirov
Telerik team
answered on 30 Apr 2014, 09:50 AM
Hi Sheuly,

Thank you for sharing the details. As I've explained in my previous mail, the problem with the groups directly from RadPivotGrid is that they are of type GroupNode (one of our internal classes), while GetAggregateValues is checking collections of other types. We'll consider improvements in this area, but meanwhile you can use the groups directly from IPivotResults:
AggregateValue aValue = results.GetAggregateResult(0, results.Root.RowGroup.Groups[0], results.Root.ColumnGroup.Groups[0]);

Each Group has Groups collection of its subitems, so you will have to iterate all of them in case you want to generate the export on your own. Another tricky part is to check if row/column is collapsed or expanded - RadPivotGrid has IsRowCollapsed and IsColumnCollapsed methods, which have parameter of type IGroup, but you have to get the group from RadPivotGrid's RowGroups / ColumnGroups collection. If you try to use IsRowCollapsed method with group from IPivotResults, the method will always return false.

Hope this helps. Feel free to contact us in case you have any problems or concerns.

Regards,
Rosen Vladimirov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
PivotGrid
Asked by
Sheuly
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Sheuly
Top achievements
Rank 1
Share this question
or