My current tasks involve generating a spreadsheet and a PDF file from the database. To create the .tsv file, I opened a new file and wrote into it details of the players and performances of the database. I first wrote into the file the headers of the spreadsheet. Next I sent a HTTP request to grab the performance and result documents based off each event document, with the event documents grabbed based off each venue document.
To improve efficiency, Dr Shawn also pointed out that I should start with searching within the partition instead of using an additional selector expression specifying the partition, which would search through more documents unnecessarily. Then from iterating through all the performance and result documents in the database, I wrote into the spreadsheet the candidate’s as well as the performance’s details. I then closed the file.
To create the PDF file, I used the Wt::Render::WPdfRenderer class as suggested by Dr Shawn. I created a table that contains the results of all performances in the database. Next, I divide the performances up into their category, with each category starting on a new page. To do this I used a nested for loop. The first loop runs through all the categories, and the second loop runs through the performances in each category. This way, I generate a table for each category. Then startPage() is placed at the end of the first loop to start a new page for the next category.