We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to best group and sum across a model

Hi -
I've been looking around for a solution to a problem for a while, perhaps syncfusion could offer that solution.

I have the following model:

OrderId User Price Quantity
101 John 7.75 100
102 Fred 8.00 150
103 John 7.75 200
104 John 8.00 125

And I'd like to create a view into this model that groups on Price & User and sums the quantities then sorts by price so the view would look like:

User Price Quantity
John 7.75 300 <-- Grouped & Summed
Fred 8.00 150
John 8.00 125

Is this possible with some of the syncfusion grouping or grid functionality?

Any thoughts about the best way to accomplish this?

Thanks - have a great morning!
Matty



4 Replies

LS Lingaraj S Syncfusion Team March 28, 2009 07:06 AM UTC

HiMatty,

Thanks for your interest in syncfusion products.

This functionality can be achieved by adding the group summary value in group header in GridGroupingControl, please try to use CaptionText and CaptionSummaryRow property.

Please refer the sample below:
http://files.syncfusion.com/support/samples/Grid.Windows/7.1.0.30/F80284/main.htm

Let me know if it helps.

Regards,
Lingaraj S



AD Administrator Syncfusion Team March 30, 2009 07:49 PM UTC

Thank you for the response.
This looks like it could be a solution to my problem - the grouping and summing is exactly what I'd like - however, is it possible to remove all of the collapsible rows and render the cells as a flat grid (just a grid with the view that I describe in my earlier request)?

Ultimately, the view shouldn't reveal the original model or any of the logic correlated with developing the view - in this case, it should just show the Name, Price, and Summed Quantity.

Thanks again for your assistance,
Matt



AD Administrator Syncfusion Team March 31, 2009 04:49 PM UTC

Matty,

Yes, this is definitely possible. We will provide you an updated sample soon.

Regards,
Praveen



AD Administrator Syncfusion Team April 1, 2009 04:22 PM UTC

Matty,

Here is the updated sample that does exactly what you want.

There is source code comments in the sample that should tell you how this is implemented. Let us know if you have any questions.





GroupSummary_b2093c7c.zip

Loader.
Live Chat Icon For mobile
Up arrow icon