Is it possible to have multiple summary rows in a single band. I have data like below and need to show Summaries as Subtotal for each unique ColA value. Is it possible to show as below without manupulating data in underlying datasource.
Thank you
ColA ColB Col C
1 a 2 1 b 51 c 3
SubTotal 10
2 x 12 z 2
SubTotal 3
3 i 43 j 103 k 43 i 5 Subtotal 23
What you can do is apply a summary to Col C, then use the OutlookGroupBy feature of the grid and group by Col A.
Set grid.DisplayLayout.ViewStyleBand to OutlookGroupBy. Then use the SortedColumns.Add method on the Band to sort column A and specifiy true for groupBy.
Thanks for quick reply. I did the samething. But that visually changes a lot. I need this first row to appear as normal first column or atmost column with merged cellstyle but definitely not as a separate band. I tried setting GroupByColumnsHidden = DefaultableBoolean.False but could not figure out how to get rid of GroupByRows. Also this ColA is not necessarily the first column, it could be any column in the table.
please advice.Thank youbhavani
Hi,
vpratti said:Right now if I set AllowGroupBy on user name, it is fine for the first user, for the second user it will be the sum of first user and second and for third user it will the sum of first, second and third.
It sounds to me like this is a problem with your implementation of ICustomSummaryCalculator. You are probably storing your summary in a member variable on the class. You are probably not clearing out the member variable when a new calculation begins.Make sure you are handing the BeginCustomSummary method and resetting any variables that are used in the calculation of your summary.
I am now having a similar problem. I have two custom summary calculators, one for FTEs (people) and one for Dollars.
When the grid does not have a column in the group by, the custom summaries work as they should:
However, when a column is added to the group by, it seems as though the two custom summaries are never updated, whereas the regular summary does update:
Also, another question related to this - is it posible to have the summary rows display for not only the rows in the group bys but also at the bottom as a summary of all of the rows?
Any help would be greatly appreciated!
Thanks,~Kelly
Can You try adding the below line at the end,
UltraGrid1.DisplayLayout.Override.AllowRowSummaries = AllowRowSummaries.Default
Hi vprattiIt still behaves the same way, but thanks for the suggestion!~Kelly
Below is the code I am using and it would calculate the row summaries just fine,
ugDashData.DataSource = dsdata.Tables(0)
ugDashData.DisplayLayout.Bands(0).Columns("USER").AllowGroupBy = DefaultableBoolean.True
ugDashData.DisplayLayout.Bands(0).SortedColumns.Add("USER", False, True)
ugDashData.DisplayLayout.Override.AllowRowSummaries = AllowRowSummaries.True
Dim BatchSummary As SummarySettings = ugDashData.DisplayLayout.Bands(0).Summaries.Add("COLUMN1", SummaryType.Count, ugDashData.DisplayLayout.Bands(0).Columns("COLUMN1"), SummaryPosition.UseSummaryPositionColumn)
Dim ImageCountSummary As SummarySettings = ugDashData.DisplayLayout.Bands(0).Summaries.Add("COLUMN2", SummaryType.Sum, ugDashData.DisplayLayout.Bands(0).Columns("COLUMN2"), SummaryPosition.UseSummaryPositionColumn)
Dim DocCountSummary As SummarySettings = ugDashData.DisplayLayout.Bands(0).Summaries.Add("COLUMN3", SummaryType.Sum, ugDashData.DisplayLayout.Bands(0).Columns("COLUMN3"), SummaryPosition.UseSummaryPositionColumn)
Dim TotalTimeSummary As SummarySettings = ugDashData.DisplayLayout.Bands(0).Summaries.Add("COLUMN4", SummaryType.Custom, New clsTotalTimeByUser(), ugDashData.DisplayLayout.Bands(0).Columns("COLUMN4"), SummaryPosition.UseSummaryPositionColumn, Nothing)
Dim ImageRateSummary As SummarySettings = ugDashData.DisplayLayout.Bands(0).Summaries.Add("COLUMN5 ", SummaryType.Custom, New clsImageRateCalculator(), ugDashData.DisplayLayout.Bands(0).Columns("COLUMN5"), SummaryPosition.Right, Nothing)
BatchSummary.DisplayFormat = "COUNT = {0}"
ImageCountSummary.DisplayFormat = "TOTAL = {0}"
DocCountSummary.DisplayFormat = "TOTAL = {0}"
TotalTimeSummary.DisplayFormat = "= {0}"
ImageRateSummary.DisplayFormat = "PER HOUR = {0}"
You may ignore the column4 and 5 I used here as I was using custom summary type to calculate the percentage and rate.
Let me know if this works for you.
Mike,
I think same code what I have for the custom summary works just fine with a new grid. For some reson the old grid is having troubles with it.
For now , I am good.
Thanks a lot , Venkat.
Thank you very much for taking time to look into this.
You are right in saying summary formula line is commented but in the actual code its not.
If I follow you correct , scrolling down to the bottm should calulate the summaries but I dont see the correct summaries. SO I was running the same code in debugger , then I see that the custom class New method getting called but dont any other methods getting called and eventually summaries are not currect.
I am not sure why those beginSummary and other methods are not gettting called when step though debugger. Any clue ?
In the other post that I had posted the complete code.
I really appreciate your help on this as I am in crunch state of the project.
Thanks, Venkat.
Hi Venkat,
Well, the line of code you have here which adds the summary is commented out. :)
Assuming that's just a typo here in this forum post and that this line is not commented out in your actual code, then my next guess would be that the summary is not yet visible on the screen. The summaries don't get calculated until they are needed. So if your summary is at the bottom of the rows collection (which is the default), the calculation will not occur until you scroll down to the bottom of the rows and bring the summary into view.
Hi all ,
I followed this thread and wrote my customSummary class and used the Custom summaryType.Tried using the same but my methods inside the custom class didn't get fired. Ami doing anything wrong.
InterCompGrid3.DisplayLayout.Bands(0).Columns("CGDTH").AllowRowSummaries = AllowRowSummaries.True 'InterCompGrid3.DisplayLayout.Bands(0).Summaries.Add("summaryCGDTH", SummaryType.Custom, New InterCompCustomSummary("CGDTH"), InterCompGrid3.DisplayLayout.Bands(0).Columns("CGDTH"), SummaryPosition.UseSummaryPositionColumn, Nothing)
Can anybody give a qucik pointer.
Thanks a Lot, Venkat.
I'm not sure off the top of my head, but if there is a way, it would probably be via the SummaryDisplayAreas property on the Override.