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.

Essential Calculate (CalcQuick) question: YEAR(TODAY()) not working?

Thread ID:

Created:

Updated:

Platform:

Replies:

132307 Aug 24,2017 07:25 AM Aug 29,2017 12:17 AM Windows Forms 3
loading
Tags: Calculate
hui zheng
Asked On August 24, 2017 07:25 AM

Hello,

we use CalcQuick to calculate some formula. The below test code uses the YEAR(TODAY()) to get the year of today. But it receives #value error. Can you give example how to use it correctly?


var calculator = new CalcQuick();
calculator.setAutoCalc(false);
calculator.setKeyValue("__formula", "=YEAR(TODAY())");
calculator.refreshAllCalculations();
var val = calculator.getKeyValue("__formula");
console.log(val); 
=> result is #VALUE! error

Thanks!
Hui

Piruthiviraj Malaimelraj [Syncfusion]
Replied On August 25, 2017 01:32 PM

Hi Hui, 

Thanks for your interest in Syncfusion products, 

We have analyzed your scenario and able to reproduce the scenario at our end. In order to resolve the reported issue, enable ExcelLikeComputations value of CalcEngine. Please make use of the below code and refer to the attached sample, 

Code snippet: 
var calculator = new CalcQuick(); 
calculator.getEngine().setExcelLikeComputations(true); 
calculator.setAutoCalc(false); 
 
calculator.setKeyValue("A", "=YEAR(TODAY())"); 
calculator.refreshAllCalculations(); 
var val = calculator.getKeyValue("A"); 

Sample link: 

Regards, 
Piruthiviraj 


hui zheng
Replied On August 28, 2017 03:44 AM

Hi,

Yes, after ExcelLikeComputations is enabled, it works.

Thanks!

Hui


Mohanraj Gunasekaran [Syncfusion]
Replied On August 29, 2017 12:17 AM

Hi Hui,  
 
Thanks for your update. 
 
We are glad to know that your reported problem has resolved. 
 
Please let us know if you have any further assistance. 
 
Regards, 
Mohanraj G 


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.

;