Hi
I'll explain my question with an example.
I have a simple summary with SummaryType.Sum. Let's say I have 2 rows, with values -2, +2. The sum is 0.
When ANY individual value in the sum is NOT zero, I want the Appearance of the summary to change (ie: Backcolor=Yellow).I can't use the sum to figure out when to change the Appearance. (In this example, the sum is 0, even though there are individual values that are non-zero.)I have tried to use SummaryValueChanged, but can't figure out how to access the individual values that make up the sum.I have tried to use a CustomSummaryCalculator (since I can access the individual values), but I can't figure out the right property to change the Appearance. I tried the summarySettings.Appearance, but nothing changed.
Any ideas?Thanks!
If you use SummaryValueChanged, you can get the rows that are associated with the summary by using:
e.SummaryValue.ParentRows
I'm not sure why the SummarySettings.Appearance does not work in the ICustomSummaryCalculator. It should work. But you would really want to use the SummaryValue.Appearance, anyway, and I'm not sure that's exposed by the interface.
Hi Mike Thanks for the reply, and sorry about the delay.
I should have mentioned I tried what you mentioned originally, and it worked when I did 1 level of grouping. (I would access the ParentRows, and go through each Cell to retrieve the individual values.)But if I add another level of grouping (group by 2 or more columns), then access the ParentRows in SummaryValueChanged, ParentRows are of type UltraGridGroupByRow, and the Cells collection is null. I can't figure out what property I then need to access to get hold of the right Row collection or Cell collection to retrieve the individual cell values.
Any ideas?Thanks
Mike
Ahhhh, that's it. The GetAllFilteredInNonGroupByRows is what I needed.
Awesome!! Thanks Mike!!
Hi,
If the ParentRows collection is returning a list of UltraGridGroupByRows, then it means that the parent rows are grouped.
Let's say, for example, that you have a grid with some rows in it. Now you group by a column. The root-level rows in the grid are no longer data rows - they are GroupByRows. The children of those rows are the actual data rows.
If you group by another colmun, then you will create a 3-level hierarchy. The first two levels are GroupByRows and the 3rd level will be the data rows.
So if the ParentRows are GroupByRows, what you would need to do is loop through that collection and get the ChildRows collection from each row. These ChildRows might be data rows or they might be more GroupByRows. If they are GroupByRows, then you need to walk down another level. You will probably need to write a routine to walk down recursively to find all of the actual data rows involved in the summary.
Or, you might be able to get what you want using methods on the Rows collection like GetAllFilteredInNonGroupRows or GetRowsEnumerator.