Posted 10 April 2019, 6:13 am EST
Hi,
We could override the default formula in the following two steps:
1). Remove the existing definition of the formula like:
GC.Spread.CalcEngine.Functions.removeGlobalFunction('sum');```
2). Add custom function with the same name using addCustomFunction method
var customFun = new CustomSumFunction();
spread.addCustomFunction(customFun);
[i]>>Modify the SUM function to take in a JSON variable as a parameter.[/i]
Formulas don't support passing JSON values as parameters, what we could do is pass a string which would represent our JSON and then parse the string inside our custom function to get the JSON.
Please refer to the attached sample which demonstrates the same and let us know if you face any issues.
Regards
[zip filename="customFunctions.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-82ba956c-eee9-4f7d-b69a-cf5a51d418d3.zip[/zip]