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

Calculate / CalcEngine / CalcQuick - tables directly from JSON

Hello,

I'm evaluating Calculate module from Essential JS 1 as it seems to fit my use case. However I need an advice on the following:

"Use with Arbitrary Objects

Use CalcQuick to add calculation support to just about anything. You can register values or formulas using an indexer on the CalcQuick object. Following this, the act of retrieving a value through the CalcQuick indexing triggers the calculation."

(source: https://www.syncfusion.com/jquery/javascript-ui-controls/calculation-engine)

I wonder it if's possible to have a JSON data structure which contains a collection of tables, then have those tables included in CalcEngine so in the end I would be able to make a calculation like `= SUM(Sales[Q2])`, given that the input json contains table with name 'Sales' and corresponding 'Q2' column.

Is it possible without imperatively adding all tables from the input json to the grid? I would like to have something in a similar fashion as `new CalcBase.setKeyValue("foo", "123") => `= [foo] + 123`.


1 Reply

MG Mohanraj Gunasekaran Syncfusion Team March 18, 2019 10:04 AM

Hi Marek , 
 
Thanks for using Syncfusion product. 
 
To perform the calculation for column values when provide the column name, you could implement the getValueRowCol and setValueRowCol method. Please refer the following UG link, 
 
 
Calc quick indexer performed based on the keys and assigned value. By this support, we could not perform the range calculation. 
 
Please get back us if you need any further assistance on this. 
 
Regards, 
Mohanraj G 


Loader.
Live Chat Icon For mobile
Up arrow icon