GetAggregateResult

4 posts, 0 answers
  1. Sheuly
    Sheuly avatar
    5 posts
    Member since:
    Nov 2013

    Posted 28 Apr 2014 Link to this post

    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

  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 29 Apr 2014 Link to this post

    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.
     
  3. DevCraft banner
  4. Sheuly
    Sheuly avatar
    5 posts
    Member since:
    Nov 2013

    Posted 30 Apr 2014 in reply to Rosen Vladimirov Link to this post

    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
  5. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 30 Apr 2014 Link to this post

    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.
     
Back to Top