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.
Unfortunately, activation email could not send to your email. Please try again.

Formula Cell - Save Formula and use outside of the grid

Thread ID:

Created:

Updated:

Platform:

Replies:

129146 Feb 28,2017 06:10 PM Mar 1,2017 08:59 AM Windows Forms 1
loading
Tags: GridControl
Adam
Asked On February 28, 2017 06:10 PM

Hi,

I'm trying to evaluate if the Formula support in the Syncfusion grids would work for us...

I have a couple of I think fairly simple questions :)

1) If I make a cell a FormulaCell type, can I get both the value and the formula (as a string) from the cell somehow?
2) If I saved that formula, could I/how would I use it again in other Syncfusion products like reporting?

The idea is we have a product that does a lot of financial calculations.  At the moment, the design is a bit cumbersome because it takes lots of values, writes them to the db, does calculations, writes those to the db, and so on.  I'm trying to move to a position where we no longer store all the results of calculations, but rather the formulas, so we can recalculate at will.   However this would also mean we would need to be able to recalculate the formulas on other outputs, like reports/dashboards etc.

Kind regards,
Adam.

Piruthiviraj Malaimelraj [Syncfusion]
Replied On March 1, 2017 08:59 AM

Hi Adam, 
 
Thanks for your interest in Syncfusion products. 
 
Query 
Response 
 
 
 
 
 
 
 
 
If I make a cell a FormulaCell type, can I get both the value and the formula (as a string) from the cell somehow? 
The formula text and the result value can be get by using GridStyleInfo.CellValue and GridStyleInfo.FormattedText respectively. In the attached sample, the formula and the values are stored in a list. Please refer to the attached sample, 
 
Code example: 
List<SaveFormula> list; 
private void button1_Click(object sender, EventArgs e) 
{ 
    for (int r = 1; r <= this.gridControl1.RowCount; r++) 
    { 
        //Gets the CellStyle of FormulaCell. 
        GridStyleInfo cellStyle = this.gridControl1[r, 5]; 
        string formula = cellStyle.CellValue.ToString(); 
        object result = cellStyle.FormattedText; 
 
        //Store the Formula string and Result in a List. 
       list.Add(new SaveFormula(formula, result, r, 5)); 
    } 
} 
 
Sample link: 
If I saved that formula, could I/how would I use it again in other Syncfusion products like reporting? 
You can retrieve those  formulas from the saved List source and use it in where you want to use those formulas. Please let us know if you have any queries. 
 
Regards, 
Piruthiviraj

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;