We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridFormulaTag - seeking clarification

I have a cell defined on my unbound grid as a formula cell that sums a number of cells on the grid. The cell's GridStyleInfo object will return a null value for FormulaTag if the cell that does the summing has not been navigated to or otherwise made visible to the user. Once the cell that displays the sum is viewed, then I can access the FormulaTag property. Is there something special I have to do to make the Text property in the FormulaTag always available or is there a better way to handle this?

5 Replies

AD Administrator Syncfusion Team August 25, 2003 03:53 PM UTC

By default, the formulas are only computed as needed. If you want to force formulas to be computed, you can try using the GridFormulaEngine.RecalculateRange method passing in the range of cells you want to calculate: GridFormulaEngine engine = ((GridFormulaCellModel)this.gridControl1.CellModels["FormulaCell"]).Engine; engine.RecalculateRange(GridRangeInfo.Cell(row, col), true);


PL Paul Laudeman August 25, 2003 08:13 PM UTC

Unfortunately, that is not working for me. I can see that the Text property of the GridStyleInfo object has the SUM value that I'm trying to run, but after I call the RecalculateRange the FormulaTag object is null. Is there a way I can just tell the grid to compute everything by default, rather than on demand? > By default, the formulas are only computed as needed. If you want to force formulas to be computed, you can try using the GridFormulaEngine.RecalculateRange method passing in the range of cells you want to calculate: > > > GridFormulaEngine engine = ((GridFormulaCellModel)this.gridControl1.CellModels["FormulaCell"]).Engine; > engine.RecalculateRange(GridRangeInfo.Cell(row, col), true); > >


PL Paul Laudeman August 25, 2003 09:28 PM UTC

After upgrading to 1.6.1.5 I noticed in the release notes a new method called "GetValueFromGrid" on the GridFormulaEngine class. This does exactly what I need, but I'm still puzzled why your first suggestion didn't work for me. Thanks anyway! > Unfortunately, that is not working for me. I can see that the Text property of the GridStyleInfo object has the SUM value that I'm trying to run, but after I call the RecalculateRange the FormulaTag object is null. > > Is there a way I can just tell the grid to compute everything by default, rather than on demand? > > > > By default, the formulas are only computed as needed. If you want to force formulas to be computed, you can try using the GridFormulaEngine.RecalculateRange method passing in the range of cells you want to calculate: > > > > > > GridFormulaEngine engine = ((GridFormulaCellModel)this.gridControl1.CellModels["FormulaCell"]).Engine; > > engine.RecalculateRange(GridRangeInfo.Cell(row, col), true); > > > > >


AD Administrator Syncfusion Team August 25, 2003 09:45 PM UTC

What version of the code are you using? The attached program seems to work OK for me in 1.6.1.5. It gets the computed value of a cell two ways, one through the style's FormattedText which works without the call to RecalculateRange, and the other way is through the FormulaTag.Text property which requires the call. Can you post a sample of what you are trying to do that does not work?


PL Paul Laudeman August 26, 2003 01:51 PM UTC

I missed adding the "true" statement to the RecalculateRange call to force it to recalculate the non-visible cells -- that fixed the problem. Thanks for including the sample to help verify that it was working properly. > What version of the code are you using? The attached program seems to work OK for me in 1.6.1.5. > > It gets the computed value of a cell two ways, one through the style's FormattedText which works without the call to RecalculateRange, and the other way is through the FormulaTag.Text property which requires the call. > > Can you post a sample of what you are trying to do that does not work? >

Loader.
Live Chat Icon For mobile
Up arrow icon