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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridTableSummaryRow - Sum only positive values

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 01:55 PM UTC

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.

Warning Icon 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.Close Icon

;