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.

Get value from formula

Thread ID:

Created:

Updated:

Platform:

Replies:

130484 May 15,2017 11:50 AM May 18,2017 05:47 AM JavaScript 3
loading
Tags: ejSpreadSheet
Bruno Figueiredo
Asked On May 15, 2017 11:50 AM

Hi,
Sorry but i didnt find this anywere, so I need to ask you what I need to do to retreave the result of a formula via Javascript.

 var obj = $("#Spreadsheet").ejSpreadsheet('instance');
  obj.XLEdit.getPropertyValue(6,4); // returns "=SUM(E5:E6)"
obj.getCell(6,4); // return the cell html element

But I need the actual value of the E5 + E6

Please give me the answer.
Best Regards


Shanmugaraja K [Syncfusion]
Replied On May 16, 2017 03:01 AM

Hi Bruno, 
 
Thanks for using Syncfusion products. 
 
We would like to let you know that we suggest you to use pass “value2” or "calcValue" to getPropertyValue method to get the result of the formula. Please refer the below code example, 
 
[JS] 
 
         
       $(function () { 
            $("#Spreadsheet").ejSpreadsheet({ 
                // Rendering Spreadsheet 
            }); 
        }); 
 
        function Result() { 
            var xlObj = $('#Spreadsheet').ejSpreadsheet('instance'); 
            // B2 cell has formula =CONCATENATE("one","big") and result is "onebig". 
            alert("The Formula " + xlObj.XLEdit.getPropertyValue(1, 1, "value") + " result is: " + xlObj.XLEdit.getPropertyValue(1, 1, "value2")); 
        } 
 
        <input type="button" value="Formula Result" onclick="Result()" /> 
        <div id="Spreadsheet"></div> 
 
 
 
 
Please refer the below documentation and JSPlayground link, 
 
 
Regards, 
Shanmugaraja K 


Bruno Figueiredo
Replied On May 16, 2017 06:37 AM

Hi,
Well I totaly missed that.
Problem solved.

But allow me to sugest something,
I think you should simplify your function names. like:
XLEdit.getCellValue(x,y) and getFormulaValue(x,y) or getCellCalcValue(x,y)

Or something else, I don't know, but be more intuitive.


Thank You,
and thank you again for the fast reply


Shanmugaraja K [Syncfusion]
Replied On May 18, 2017 05:47 AM

Hi Bruno, 
 
Thanks for your suggestion, we have an option to get the formula cell value. If we add the separate methods like getting cell value and getting formula cell value, it may increase the size of the source. Since, we have lot of methods in our ejSpreadsheet control.  
 
Regards, 
Shanmugaraja K 


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.

;