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

Conditional column aggregates

4 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 2
Frank asked on 12 Sep 2011, 08:50 PM
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

4 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 13 Sep 2011, 09:49 AM
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 >>

0
Frank
Top achievements
Rank 2
answered on 13 Sep 2011, 01:38 PM
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  
0
Pavel Pavlov
Telerik team
answered on 16 Sep 2011, 01:21 PM
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 >>

0
Accepted
Pavel Pavlov
Telerik team
answered on 19 Sep 2011, 01:08 PM
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 >>

Tags
GridView
Asked by
Frank
Top achievements
Rank 2
Answers by
Pavel Pavlov
Telerik team
Frank
Top achievements
Rank 2
Share this question
or