Preventing CalcQuick Formula Parsing

Encountering issues using CalcQuick in a complicated scenario that can be summarized with the following example:         

CalcQuick calc = new CalcQuick();            
calc["a1"] = "5";
calc["a2"] = "3";         
calc["json"] = "{\"ip\":\"127.0.0.1\",\"msg\": \"Hello[12345]World\"}";
return calc.ParseAndCompute("SUM([a1], [a2])");

Line #4 is particularly troublesome as CalcQuick attempts to parse two formulas from this JSON string value and will throw the following exception:

System.ArgumentException: Unknown key: 12345
at Syncfusion.Calculate.CalcQuickBase.MarkKeys(String formula)
at Syncfusion.Calculate.CalcQuickBase.ParseAndCompute(String formulaText)
at Syncfusion.Calculate.CalcQuickBase.set_Item(String key, String value) 
at ...

Is there a way to configure CalcQuick to not attempt to parse the strings given to the indexer for formulas? In this use case, I'm looking to only ever execute a formula using ParseAndCompute.

3 Replies

TL Thirumurugan Loganathan Syncfusion Team February 13, 2018 01:36 PM UTC

Hi Brant, 
 
We are able to reproduce the reported issue “Argument exception occurred in Calculate while parsing the formula”. Hence we have logged defect report on this and this fix will be included in 2018 Vol 1 SP 1 release.  
 
Regards, 
Thirumurugan 



BW Brant Wheeler June 18, 2018 03:45 PM UTC

Hi Thirumurugan,

Can you confirm if the fix for this defect was included in the 2018 Vol 1 SP 1 release and what the fix # was if so?

Thank you!


KB Kanimozhi Bharathi Syncfusion Team June 19, 2018 12:49 PM UTC

Hi Brant,  
 
If you want to retain the strings without parsing in CalcQuickBase, then you need to enclose with \” to the strings. Please find the code sample for your reference, 
 
calc["json"] = " \”{\"ip\":\"127.0.0.1\",\"msg\": \"Hello[12345]World\"}\” "; 
 
Regards 
Kanimozhi B 


Loader.
Up arrow icon