Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
350
How to do the calculations manually?
posted

Hi,

  I have an UltraGrid with more than 100 rows, and 3 or more groups, and each group with 3 or more columnas, 2 of those columns has a formula. So i put the CalcFrecuency = Manual and i use an UltraButton to do the calculations. In the button i use : this.ucalcXXX.ReCalc(). I dont know if its ok, i want to know if there is another better way to do this, because:

1. Before the calculations, when i scroll down in the grid, the render is slow like little pauses. But when i use SuspendCalc() the scroll down is normal.

2. When i press the button and the calculations are done, only the cells that are visible in that moment are filled with the calculate data, if i scroll down the grid, the other cells are in blank and i have to press the button to calculate again for those rows. i'm doing something wrong?

3. A formula in a column apply to all the cells in that column, but there is any flag or method to avoid the calculation in some cells inside that column?

 

Lois.
Best Regards

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi Lois,

    linksolutions said:
    1. Before the calculations, when i scroll down in the grid, the render is slow like little pauses. But when i use SuspendCalc() the scroll down is normal.

    I'm not sure why this would be. What version of the grid are you using? Do you have the latest Hot Fix? There were some known performance issues related to formulas in grid's using OutlookGroupBy that were fixed a while ago.

    linksolutions said:
    2. When i press the button and the calculations are done, only the cells that are visible in that moment are filled with the calculate data, if i scroll down the grid, the other cells are in blank and i have to press the button to calculate again for those rows. i'm doing something wrong?

    By default, the grid is set up to calculate the visible cells first. This is intended to provide a better user experience when the calculations are being done asynchronously. But it doesn't make sense in your case. What you need to do is set DeferredCalculationsEnabled to false (on the UltraCalcManager) so it doesn't do this.

    linksolutions said:
    3. A formula in a column apply to all the cells in that column, but there is any flag or method to avoid the calculation in some cells inside that column?

    You can't do this directly, but you could probably get the behavior you want like so:

    1. Add an unbound column to the grid. The InitializeLayout event is a good place to do this.
    2. Use the InitializeRow event to populate this column with values. But only populate the cells you want to be used in the calculation. For the others, just leave the cells set to DBNull.
    3. Use this unbound column for your formula.
Reply Children