In my Brandeis Conejo application report generation on the server seems to have issues with large reports.
The report generation consists of several phases:
- Stage report data. runs the report queries and writes the resulting data into a staging table such as StageMemberList This is called from client function GenerateEmails, which calls StageReportsServer, and uses a callback function.
- The callback then runs a new function, RenderStagedReports, which first calls CleanupReportPDFBatchesServer so old batches are removed. Then it calls RenderStagedReportServer to generate the PDF file and write the returned base64 text to the StageReportPDFs table. This also has a callback function in the client.
- The BuildEmailAttachments client function calls BuildEmailAttachmentsServer to actually sort through the data and build the attachments. This also has a callback function.
- The client function SendGeneratedEmails is called, which in turn calls GenerateEmailsServer function which runs in the background, so no callback processing is done.
Mostly this works fine, but if I have a LARGE report, it will not process. I end up with a blank message in Five, and when I click on the OK button, Five restarts.
To reproduce the issue:
- Go to Processing > Generate Emails.
- Select Board Members for the email type.
- Under Reports, select all reports.
- Under Groups, select all groups.
- Click Generate Report button.
The first time I ran this, the error seems to occur during the rendering phase, because nothing happens for a long time, then the error occurs. In this scenario, I saw a bunch of reports were staged, but the error seemed to occur when this report was trying to be rendered or staged.
When I restart Five and try this with only the Member List report, then it works.
The main difference between the original code and current code is that instead of attaching the reports to the emails, I am uploading them to FilePost, a web file sharing and storage site. Then I put the returned shortcut into the outgoing emails, and they can be clicked on by the recipient and see/download the report.
If you want to try it, I recommend going into Setup>Settings and change the EmailFromAddress to your own for testing.
Log on as Admin with the credentials I gave you before. This enables you to take advantage of the pdf caching, so most reports don’t need to be rendered again.
The FilePost API key is stored in the Settings table, so you don’t need to do anything other than run the application.
So it seems like the Member List is still the culprit. I redid the run but this time did not include the Member List, and it ran completely. I have no idea why that report is so large. I have the PdfImageQuality setting set to 0.5.
One more point: This time the failure seems to be in the Render Reports phase, not the last phase of sending the emails. We may have been premature in assuming the issue was in the last phase, and making the last server function run in the background.
I hope you can help me figure this out.
Thanks so much…