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.
Unfortunately, activation email could not send to your email. Please try again.

GridTableSummaryRow - Sum only positive values

Thread ID:

Created:

Updated:

Platform:

Replies:

123356 Mar 9,2016 03:10 PM Mar 10,2016 08:55 AM WPF 1
loading
Tags: SfDataGrid
MARQUANT Cédric
Asked On March 9, 2016 03:10 PM

Hi,

If there a way to only display the sum of positive values in the GridTableSummaryRow  ?

Regards,

Gnanasownthari Thirugnanam [Syncfusion]
Replied On March 10, 2016 08:55 AM

Hi Marquant,

We are analyzed your query. And you can achieve your requirement “only display the sum of positive values in GridTableSummaryRow” by using the CustomAgreegate like the below code example.

C#



public
class CustomAggregate:ISummaryAggregate

    {

        public CustomAggregate()

        {

        }

        public double PositiveSummation { get; set; }


        public Action<System.Collections.IEnumerable, string, System.ComponentModel.PropertyDescriptor> CalculateAggregateFunc()

        {

            return (items, property, pd) =>

            {

                var enumerableItems = items as IEnumerable<OrderInfo>;

               foreach(var item in enumerableItems)

               {

                   if(item.Discount>=0)

                   {

                       this.PositiveSummation += item.Discount;

                   }

               }              

            };
        }




We have prepared a sample as per your requirement and you can download the same from the below location,

Sample : http://www.syncfusion.com/downloads/support/forum/123356/ze/Summaries571578970

Please refer the below UG link to know more about the Custom Summaries,

Link : http://help.syncfusion.com/wpf/sfdatagrid/summaries




Regards,

Gnanasownthari T.



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;