<div dir="ltr"><div>In my last email I talked about the potential issues implementing Formulas in ReportBuilder without using the Pentaho library. I'm happy to report that during the last week I think I've found a solution that I've implemented in the following patch. It allows you to add a Formula, with the caveat that it has no parameters.</div><div><br></div><div><a href="https://gerrit.libreoffice.org/c/core/+/185810">https://gerrit.libreoffice.org/c/core/+/185810</a></div><div><br></div><div>The patch uses XFuntionAccess callFunction, which I found doing some searching during the week. The following documentation from the SDK Development Guide has more information about using XFunctionAccess</div><div><br></div><div><a href="https://wiki.documentfoundation.org/Documentation/SDKGuide/Functions_and_Data_Analysis">https://wiki.documentfoundation.org/Documentation/SDKGuide/Functions_and_Data_Analysis</a></div><div><br></div><div>The API Reference for XFunctionAccess can be found here</div><div><br></div><div><a href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XFunctionAccess.html">https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XFunctionAccess.html</a></div><div><br></div><div>A couple of notes about this:</div><div><br></div><div>1. A quick look through the list of available functions and it seems that they match up with what is  currently available in ReportBuilder. If there are specific functions missing, they could      potentially be implemented in C++ since they would be few in number. </div><div><br></div><div>2. Using XFunctionAccess abstracts away the function input and output types to uno::Any. It is to be determined whether this will make things easier or harder. My current plan is to get the Formula code as operational as possible, then move on to the next step of implementing the Grouping code, and then come back to this issue.</div><div><br></div><div>3. A Formula may contain other Formulas, database input or be entirely user defined. This means that a Formula must be parsed and potentially compiled. There is a library for this located here </div><div><a href="https://opengrok.libreoffice.org/xref/core/include/formula/">https://opengrok.libreoffice.org/xref/core/include/formula/</a></div><div>There is also some Java wrapper code that uses some Pentaho libraries that seems to have roughly the same function, located here </div><div><a href="https://opengrok.libreoffice.org/xref/core/reportbuilder/java/org/libreoffice/report/pentaho/SOFormulaParser.java?r=bb437029c1e5331bcc3f8fb2fc87837142a52f33">https://opengrok.libreoffice.org/xref/core/reportbuilder/java/org/libreoffice/report/pentaho/SOFormulaParser.java?r=bb437029c1e5331bcc3f8fb2fc87837142a52f33</a></div><div><br></div><div>Which leads to my current progress, trying to get Formulas parsed in some meaningful way using the libraries in include/formula. Currently I'm working on getting a working Reference to an XFormulaParser UNO object in reportdesign/source/filter/xmlExport.cxx.</div><div><br></div><div>If anyone knows of any documentation or good examples of using the parser or compiler located in include/formula I would be very appreciative of any information. </div><div><br></div><div>That's it for now, thanks for reading and have a good week.</div></div>