I have a project estimation application that is currently in use where I have a grid displaying summary data that is using two group by columns. The final screen in the application is similar to a final estimated cost of a project grouped by a major category and sub categories. For example, materials, engineering and labor are the major categories and then each one has subcategories. The user can then adjust factors such as percentage mark up, percentage risk and sales commission to add to the estimate cost and arrive at a final sales price that is submitted to a potential customer. When the user makes a change to one of these factors I recalculate the results in the underlying data table and the data is updated in the wingrid. I am displaying a summary dollar total for each category and sub category and then a final grand total at the bottom of the gird.
I have been receiving complaints from the users that sometimes the sum of the sub totals and the grand total do not add up to the same value. Of course when one of the users tried to show me it appeared to work just fine and just wrote it off as user error. As if it meant anything I tried to explain to the user that the grid control automatically calculates the sub total and total values so I doubted very much that they would not match. But today I just saw it happen with my own eyes where a user updated the mark up percentage on an estimate and the subtotal and grand total did not add up. If I'm not mistaken the group by totals did not update, but the grand total updated and was correct.
In my last post I had a situation where the group by column was not displaying correctly using an ADO column with an expression as the source. I had to use the .Bands(0).SortedColumns.RefreshSort(True) method on each grid every time I added a new record for the grid to display correct. Using the same technique to get around that problem I am able to get the grid to correctly update and the subtotals and grand totals add up correctly.
As you might imagine this whole thing was a big surprise to me. I no longer feel comfortable assuming the wingrid is going to display the correct group by summary values unless I manually kick the grid every time something changes. I don't know if this has anything do with the problem I discussed in my last post, but it seems very coincidental. The groups in a wingrid don't appear to always update when the underlying data changes.
I'm running release v9.1.2009.2029.
Hi Steve,
How are you doing the summaries in your grid? Are you using the regular summary enums like sum? Or are you using formulas?
I can't explain how the grand total could be correct when the sub-totals are not. It would almost make sense if it was the other way around, and it's possible for something like that to happen temporarily when using formulas, since the formulas are calculated asynchronously. But it would only be temporary in that case and you would almost never see a delay unless you have a pretty large number of rows in the grid.
I've certainly never seen this happen before. I suspect you must be right and that it is somehow related to the other issue you mentioned with the calculated values in the data source.
In the WinGrid designer feature picker I set allow row summaries to true and then selected the sum option for my totals column. I then checked off Bottom Fixed and GroupBy Rows Footer in the summary display area. I wasn't doing anything fancy which was why I was surprised when I saw it happen.
I'm going to try and recreate the problem to make sure I was saying correctly that the subtotals were wrong and the total was right. I could have it backwards.
That's weird. I've never seen anything like that.
Is it possible you have hidden rows in the grid which are being taken into account for the Grand Total, but not for the sub-total?
Can you duplicate this in a small sample project so we can check it out?
The only filtering I'm doing is on the grid binding sources for what group of information they are displaying. I know... weird stuff.
I can certainly workup an example project, but I have to first finish up what I'm working on right now because I have people standing at my door everyday asking me if I'm done yet.
I am experiencing exectly same issue with Ultragrid 9.1
group totals are not updating as grand total at the bottom does
There seems to be bug in Group By summary calculation. And it's happening in 10.3 version. I have replied to other post to find an answer.
For more information, I am implementing custom summary and binding to the grid using BindingList<T>
I am experiencing this problem (or a very similar problem) in 10.3.
Here is what my users sees - note the total under columns such as Rtl Units is obviously incorrect.
here is the code that does the group by when the user calls up the screen:
grdRSTSIST1.DisplayLayout.Bands(0).SortedColumns.Add("DEPT_CODE", False, True)
If I remark out that line, this is what my user sees - note that the total under Rtl Units is now correct:
If I insert the DoEvents just before the offending line, like so:
Application.DoEvents()grdRSTSIST1.DisplayLayout.Bands(0).SortedColumns.Add("DEPT_CODE", False, True)
This is what the user sees - note that the total is now correct.
I have tried to add the following line, but it did not fix things:
grdRSTSIST1.Rows.Refresh(UltraWinGrid.RefreshRow.RefreshDisplay)
Nor did this:
grdRSTSIST1.ResumeSummaryUpdates(True)
I would really not like to leave a DoEvents in my code.
Please help.
Walter J. Zielenski
Hello Walter,
Could you please try to attach if possible a small sample project reproducing the above mentioned issue, I will be happy to take a look at it.