Skip to main content

Prevent getting empty reports


If there is no data to include in a report, FA generates an empty document. This might happen, for example, if you need to report new transactions created in a portfolio every month for multiple portfolios. In this case, FA produces a report even if a portfolio does not have any new transactions during the month.

Using an afterRender() function to prevent empty reports from generation

Use an afterRender() function in your report script to control the report generation based on the data the report received. Implement your report-specific condition in that function. If you do not want the report to be generated, throw an error.

Here is an example of an afterRender() function that prevents the report generation if the report's transaction list is empty:

async function afterRender(req, res) {
  if( === 0) throw new Error("Empty report")

Skipped reports in the report generation

Please consider the following when applying the solution:

  • If you create a report from FA Back Report windowand your afterRender() function throws an error, you will be prompted with an unspecified error screen.

  • If you create a report for a group of portfolios and your afterRender() function prevents the report generation for some of the portfolios, the excluded portfolios will be reported as "generation failed" in the report generation summary CSV file.