Hi,
Firstly apologies if this is a simple mistake on my part or has been covered elsewhere but I've just started back with the grid and calc manager and am struggling to get the attached to work (VS2010 with 2013.2075)
Simple project attached and when I click in the new row the formula for column d doesn't appear to work but it works fine for existing rows. If I change the DeferredCalculationsEnabled to True on the calc manager then it works fine but my summary isn't fully calculated unless the grid is fully scrolled. I've tried various combinations of the DeferredCalculationsEnabled and CalcFrequency but just can't seem to get it to give a complete summary and complete the formula for a new row.
Any help greatly appreciated.
Thanks
Hello,
The DeferredCalculationsEnabled will set the calculations on the visible objects. In this case, the visible rows. If you run the sample the with this property set to True, then the scrolling is required to get grand total for all your rows.
Can you clarify by the following?
when I click in the new row the formula for column d doesn't appear to work but it works fine for existing rows
After adding a new row to your data, the calcmanager auto detects and adds it the entry to the total. Does this occur for you?
Mike / Michael, thanks for looking into this for me. I think the summary might be confusing things a little but I'll come back to that. So if deferred calcs are:
- TRUE - then when I click the add row the formula in column d is prefilled with a 0 and works should you enter a value in column a and tab to column b, you don't need the row to be added full. Editing existing rows work the same.
- FALSE - then when I click the add row the formula in column d doesn't get prefilled or work until the row is actually added to the grid fully. However, editing an existing row then changes in d are immediately apparent on leaving a cell but without leaving the row
If I didn't care about the summary I could just change the deferred calcs to TRUE and all would be well. However, I'd like a summary at the top showing the summary of all rows not just those visible initially or that have been scrolled into view. To do this I need to set deferred calcs to FALSE.
I think this makes my requirements a bit clearer but if not let me know. As I say there may be some combination of something I'm missing or I might be going about things in the wrong way.
Thanks in advance for your thoughts.
weejock said: - TRUE - then when I click the add row the formula in column d is prefilled with a 0 and works should you enter a value in column a and tab to column b, you don't need the row to be added full. Editing existing rows work the same. - FALSE - then when I click the add row the formula in column d doesn't get prefilled or work until the row is actually added to the grid fully. However, editing an existing row then changes in d are immediately apparent on leaving a cell but without leaving the row
That's the same behavior I get with your sample.
DeferredCalculations just means that the grid will defer calculations that are out of view. It's a performance tweak so that the grid gives preference to the calculation of formulas that are visible on the screen. So when it's true, the grid gives top priority to the formulas that the user can see, which includes the TemplateAddRow. When it's false, I can only assume that there are other calculations taking place and since the TempalteAddRow is not a priority, it's getting put off, but will eventually be calculated. This doesn't really make sense, though, since you don't have a huge number of rows in your sample and the TemplateAddRow should probably be calculated almost immediately, anyway. So I think there's probably a bug there.
weejock said:If I didn't care about the summary I could just change the deferred calcs to TRUE and all would be well. However, I'd like a summary at the top showing the summary of all rows not just those visible initially or that have been scrolled into view. To do this I need to set deferred calcs to FALSE.
If the summary is being calculated based on only what is in view, then something is wrong. That should never happen - or at least it should not be based on DeferredCalculationsEnabled. DeferredCalculationsEnabled should only affect WHEN the formulas are calculated, it should not have any effect on the calculation results.
Mike, where does that leave us then? If it's a bug do I need to report this somewhere or is it something you will pick up and if so how do I track it?
Cheers
This property is causing issues on form load.
As a test, I was able to get the expected behavior by changing the deferred calc to true within the BeforeEnterEditMode event. With the sample you provided, the property needs to be false in the designer initially, then wait for the form and calculation to load the data correctly. After which you can set the property back to true to get the expected behavior.
Private Sub UltraGrid1_BeforeEnterEditMode(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles UltraGrid1.BeforeEnterEditModeUltraCalcManager1.DeferredCalculationsEnabled = TrueEnd Sub
I don't recommend changing the DeferredCalculationsEnabled at runtime ie. or by the BeforeEnterEditMode. This was to illustrate that the property is causing unexpected behavior. We need to investigate this further and provide you with a viable solution.
I have opened a private case for you so that I can link it to two internal development issues. This way you will be notified automatically when a development issue is updated. The case number is CAS-143003-P8X6J3. You will see it located here: https://www.infragistics.com/my-account/support-activity
The two issues are as you have reported when toggling the DeferredCalculationsEnabled. You will find more details about these two development logs in the case.
Let me know if you have any questions regarding this matter.
OK, thanks Michael, I'll keep an eye on the development issues you've created.
Hi,I've been looking into these two issues.
Issue #1 - The summary is not including the cells that are out of view when DeferredCalculationsEnabled is TRUEThis is not a bug. I didn't notice it when I ran your sample, but your summary is not using a formula. Instead, it's using an ICustomSummaryCalculator. The problem with this is that it means the summary is not part of the calculation network. The grid and the CalcManager don't know what your summary calculation involves, so the calculation network doesn't know that your summary is dependent on the formula in column D.
The ICustomSummaryCalculator you are using is working correctly. It's including every row, but the value in the cells for that row is returning Nothing for any cells that are out of view. The same thing would happen if you checked the value of the cells anywhere else in code.
There are two possible solutions to this issue.
1) You could use a Formula for your summary. This would be a little tricky, since your summary is complex and needs to build a string including more than one value. Your formula would probably be pretty unwieldy, although you might be able to reduce the complexity by making your own custom function(s).
2) The second option is to force the calculation of column D before the summary is calculated. This is easier, but it kinda defeats the purpose of DeferredCalculationsEnabled.
If you want to try to second approach, you have to change your SummaryTotals class so that it has a reference to the UltraCalcManager as an IUltraCalcManager. So, for example, you could pass it into the constructor:
Friend Sub New(ultraCalcManager As IUltraCalcManager) Me.ultraCalcManager = ultraCalcManager End Sub
Then, in the BeginCustomSummary method, you would force column D to be calculated:
Dim columnRef As IUltraCalcReference = ultraCalcManager.GetReference("//UltraGrid1/abc/d") ultraCalcManager.EnsureCalculated(columnRef, True)
I am attaching a modified version of your sample here that demonstrates this working.
Issue #2 - When DeferredCalculationsEnabled is FALSE the cell in the TemplateAddRow is not calculated until you leave the row.
I am unable to duplicate this issue using our latest internal build or the latest available service release. So I think this may have been fixed by the fix for some other (related) issue.
Mike,
Sorry for the delay and thanks for the update however I still can't get it to work. I've downloaded your new version with the extra bits of code, upgraded to 14.1.2014.1.2059 and re-run. I still get the same behaviour:
- Deferred Calcs = True - template row works but summary doesn't
- Deffered Calcs = False - template row doesn't work but summary does
Can you please check and let me know if I'm missing something.