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.
ColA ColB Col C
1 a 2 1 b 51 c 3
2 x 12 z 2
3 i 43 j 103 k 43 i 5 Subtotal 23
Is this a good place to start: Using WinCalcManager to Create a Calculated Summary in WinGrid
Thanks again for your help!~Kelly
I finally got through reading some of the documentation and doing some sample projects for the calc manager.
In the two grids, each column summary in the summary row is named as follows: Month#Count (where # ranges from 1-18). So how to I go about referencing those summaries in the formula of the calc manager?
Since I want the difference of the two summary rows to show up in the second grid, do I add another summary for each of the 18 month columns?, i.e.
With GridName.DisplayLayout.Bands(0) .Summaries.Add("Month1Variance") With .Summaries.Add("Month1Variance") .Formula = ? <--no clue on this one, maybe "[Grid2.Summaries("Month#Count")] - [Grid1.Summaries("Month#Count")]" ??? .SummaryPositionColumn = GridName.DisplayLayout.Bands(0).Columns("1") .SummaryPosition = SummaryPosition.UseSummaryPositionColumn End WithEnd With
Your help or reference to an example would be most appreciated!~Kelly
This is what I have for the formula, but I get a #REF! error since I do not know how to reference the correct summary in the other grid:
With UltraGridName.DisplayLayout.Bands(0) .Summaries.Add(MonthCounter.ToString & " Variance", SummaryType.Formula) With .Summaries(MonthCounter.ToString & " Variance") .Formula = "[Month1Count()] - [//OrigDemandGrid/Bands/0/Month1Count()]" .SummaryPositionColumn = UltraGridName.DisplayLayout.Bands(0).Columns("1") .SummaryPosition = SummaryPosition.UseSummaryPositionColumn End WithEnd With
Sorry, this turns out to be a lot more complicated than I thought it would be.
I'm attaching a small sample project here to demonstrate.
It looks like summaries in the grid don't use their keys as the reference names. I'm not sure why this is, but it's probably so that column keys and summary keys are always unique.
It also appears that there is a bug when you try to use a summary reference in a formula in another grid. It raises a NullReferenceException and I don't know why. Feel free to Submit an incident to Infragistics Developer Support regarding this bug and include my sample project if you like.
So it looks like the only way this will work right now is if you will re-include the original formula in the second formula. This is not very efficient, but it's the only way I cound find to get it to work.
Thank you so much for your research into this matter and for taking the time to create a sample application.
When following along with the sample projects from the support website, I was able to reference the summary in another grid; however, it references it as follows (I would attach a sample, but it is larger than 200kb): [//UltraGrid1/Order Details/Grid1Sum()]
Whereas the summary in the current grid is simply referenced as: [Grid2Sum()]
In the example, data is bound via the gui, whereas for my project it will be bound programmatically; therefore, my Band(0) does not have a key to reference. Is that why I am unable to reference my band that contains the summary correctly?
My sample was working, but I just tried running it again and I do get the null reference exception as you mentioned. I suppose I will submit an incident report, but in the meantime attempt to do it via your other suggestion - ICustomSummaryCalculator - if you could point me in the right direction with that I would be most appreciative.
Okay. Here's a quick sample of using an ICustomSummaryCalculator to do the same thing.