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 : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to calculate summaries for both minimum and maximum values of the Date field?

Description

There are no default summary types to find min/max values for a particular column. To find min/max values for a particular column, create a custom summary. To create a custom summary, refer to the following solution.

Solution

To create a custom summary, derive the SummaryBase class and then the Combine() method is used to get the new summary value by comparing it with other summary values. In the given sample, DateMaxSummary and DateMinSummary are the two sealed classes derived from the SummaryBase to find the min/max date summary values.

The following code example demonstrates how the Combine() method compares and gets the maximum date value.

C#

VB

C:\Users\ApoorvahR\Desktop\Note.pngNote: Similarly DateMinSummary is also derived from the SummaryBase class.

Use the following steps to create the date summary field.

Step 1: Create GridSummaryColumnDescriptor instance.

C#

 VB

Step 2: Use the QueryCustomSummary event to instantiate the custom summary for maximum and minimum date.

C#

 VB

C:\Users\ApoorvahR\Desktop\Note.pngNote: Hook the QueryCustomSummary event before adding the custom summary fields.

Step 3: Update the summary values.

Using the CurrentRecordContextChanged event, you can immediately update the summary values by invalidating the current record.

C#

 VB

The following screenshot illustrates the min/max date summary in GridGroupingControl.

Figure 1: Min/Max Date Summary in GridGroupingControl

Sample Link

MinMaxSummaryGGC-C#.zip

MinMaxSummaryGGC-VB.zip

Article ID: Published Date: Last Revised Date: Platform: Control:
700 04/30/2011 03/09/2015 WinForms GridGroupingControl
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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