Conditional column aggregates

5 posts, 1 answers
  1. Frank
    Frank avatar
    5 posts
    Member since:
    Jun 2012

    Posted 12 Sep 2011 Link to this post

    Hello,

    I have a problem that I have not been able to find a solution to.

    I am working with a Silver light Rad grid view and have alternating rows of data. Each row represents either a weight or a price for a particular month. Each column has a different month. I need column aggregators  for each month but only want the rows associated with the weight included in the sum. One of the columns in the grid has content that identifies  that row as a weight row.

    Does anyone know hwo to do this?

    Thanks,

    Frank
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 13 Sep 2011 Link to this post

    Hi Frank,

    You will need to create a custom aggregate function.  The example in the link demonstrates how you can create your own aggregation logic . Within your custom aggregate function you may filter your data  and work only with the "weight " rows.

    Let me know in case you find troubles implementing this approach .

    Best wishes,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Frank
    Frank avatar
    5 posts
    Member since:
    Jun 2012

    Posted 13 Sep 2011 Link to this post

    Hi Pavel,

    I see how I could use the custom aggregate function to sum the rows I need, but do not see how I can filter based on the value in a differant column. My senerio would be simular to : Say I had 2 columns and 4 rows. The columns would be record type and September.

    Record type , September
    Price, 100
    Weight, 50
    Price, 200
    Weight, 75

    Price total: 300

    I am having difficulty in figuring out how to get the sum of the September column filtered by record type = Weight. A specific example of how and where to do this would be greatly appreciated.

    Thanks,

    Frank  
  4. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 16 Sep 2011 Link to this post

    Hi Frank,

    I am preparing a sample application for you . I will attach it as soon as it is ready ( later today ).

    Best wishes,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Answer
    Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 19 Sep 2011 Link to this post

    Hi Frank,


    Thank you for your patience. I am attaching a sample application with the recommended approach - using generic custom aggregate function .

    Kind regards,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top