I want to add a special column summary (COL 2 - in attached picture). In column 1, summary is straight forward (sum of individual rows) but in column 2, i have a number and want to show in summary. Please suggest how can we add this in summary ?
Hi Bharat,
You lost me along the way... I'm attaching a sample that uses a Formula Summary, a Custom Summary, and an External Summary just to show what I was explaining in the previous response. You can use the Custom summary and just return the value and not process each row in the aggregate method. From what you've described though it looks like using an External Summary will be more suited to your needs and eliminate the calls to the aggregate method that would now be unnecessary (assuming you are not requiring a calculation from the iteration of the rows of the summary and you already know what to put in the summary value). Note though that I've also seen some pretty neat stuff with customers in the past using the Formula in unique ways but for now take a look at the example and look at how the External Summary just stops the normal process of our summary calculations and just says here's an event, tell me what value to put in the summary.
Hi Matthew,I am already using ICustomSummaryCalculator for summaries but using this interface can only show the summary based on grid rows.like: Sum of column values and show result on summary (in column 4 - attached screenshot).Right now, I am setting grid column summaries at the time of Form Load then adding values from a dictionary to grid columns.After this
grdData.DisplayLayout.Bands[0].SortedColumns.RefreshSort(true);
And got the updated summaries but I want to show some numbers in summaries similar with column 5 and these numbers are in dictionary.
There are a few ways you can accomplish this task of adding a summary to display a special value. First you could use the SummaryType of Formula and set the formula equal to the special value you want to show. Another way would be to set the SummaryType to Custom and implement the ICustomSummaryCalculator interface. There is a nice walkthrough in the help for the SummaryType.Custom via http://help.infragistics.com/Help/Doc/WinForms/2014.2/CLR4.0/html/Infragistics4.Win.UltraWinGrid.v14.2~Infragistics.Win.UltraWinGrid.SummarySettings~CustomSummaryCalculator.html and then you would just return the value you want in the EndCustomSummary function. Third you could also implement an ExternalSummaryCalculator and by-pass the built-in capabilities of the summary logic and just spit out the value you want, which is explained in the help via: http://help.infragistics.com/doc/WinForms/2014.2/CLR4.0/?page=WinGrid_Performing_External_Summary_Calculations.html.