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
close icon

Using Multiple Columns in Custom Summaries in GridGrouping Control

Hi, I''m trying to create a custom summary that provides a weighted average. In the ISummary:CreateSummaryMethod() of my custom summary implementation I need way of accessing a field that isn''t the field being summarized. Is it possible to do this? Thanks, Ben.

4 Replies

AD Administrator Syncfusion Team August 4, 2004 11:54 AM UTC

Hi Ben, you can access any field (or multiple fields) from the record. See this example: public static ISummary CreateSummaryMethod(SummaryDescriptor sd, Record record) { object obj = record.ParentTableDescriptor.Fields["Weight"].GetValue(record); // -or - // you could also access values from outside the table here, e.g. a external table // of weights. You only need to make sure then that if you change values in the external table // that you then call InvalidateSummariesTopDown on the grids Table object. bool isNull = (obj == null || obj is DBNull); if (isNull) return Empty; else { double val = Convert.ToDouble(obj); return new TotalSummary(val); } } Stefan


AD Administrator Syncfusion Team August 6, 2004 06:00 AM UTC

Hi Stefan, Implemented this and it does exactly what I need. Many thanks, Ben.


MS Mohammed Sharikh March 22, 2006 09:30 AM UTC

Hi, Could you please post the implementation of the weighted average custom summary? I am having problems getting it to work because the docs don''t describe how to use custom summary delegates.. >Hi Stefan, > >Implemented this and it does exactly what I need. > >Many thanks, > >Ben.


AD Administrator Syncfusion Team March 23, 2006 05:55 AM UTC

Hi Mohammed, I am sorry for the delay in responding. Attached is a sample that implements the Weighted Mean Custom Summary. Let us know if you have any further queries. Regards, Calvin.

17230.zip

Loader.
Live Chat Icon For mobile
Up arrow icon