In the last two weeks I've been working on implementing the Grouping functionality in ReportBuilder. Somewhat unsurprisingly this has taken more time than anticipated.
My original solution for the implementation was to try and use some SQL queries to group the necessary data. If possible this would save quite a bit of work and time, and also offload a lot of work to the database where it could be trusted to perform. The crux of the matter is that the data needs to be accessed sequentially and SQL grouping queries are meant for aggregating data. There are some other options such as WINDOW functions, LAG and LEAD, and using SELF JOINS. Unfortunately, since we're using an abstraction layer over the underlying database, these functions aren't supported in the LibreOffice code base. So after discussing with my mentors it was decided to go ahead and implement the functionality in C++. I've been slowly chipping away at this and have made good progress. Part of the process was just using the UI in ReportBuilder to fully understand what the different grouping functions actually do and then decide which types these functions should work on and write a short algorithm for comparisons that accepts and handles the different types. There are just a few more functions such as group on "quarter of year" that remain to be implemented. For the time being I've moved on to adding the headers and footers appropriately as that is the last step in the process and greatly aids debugging since you can just look at an exported Report and see if it is exported correctly. The last part of the Grouping functionality is the ability to perform aggregation functions on the groups such as count, highest, lowest, etc. These are all possible to perform in SQL my current plan is to try and produce temporary tables to query against for these results. That's it for now, thanks for reading, Adam Seskunas