Server-side Report builder

  
      // Server side report generation
const fs = require('fs');
const UBReport = require('@unitybase/ubs/modules/UBServerReport');
let reportResult = UBReport.makeReport('test','pdf',{});
if (reportResult.reportType === 'pdf') {
 console.debug('Generate a PDF report of size=', result.reportData.byteLength)
 fs.writeFileSync('d:/result.pdf', result.reportData )
} else {
 console.debug('Generate a HTML report of size=', result.reportData.length)
 fs.writeFileSync('d:/result.html', result.reportData )
}
  

Classes

Methods

# makeReport (reportCodestring | Object, reportTypeoptstring, params*) → ReportResult static

Render report with code reportCode on the server side Report templates and creation rules are defined in ubs_report entity.

Arguments:
  • reportCode: string| Object

    If reportCode type is Object it is a config object { code: String, type: String, params: String|Object }

  • reportType = 'html': string

    Possible values: 'html'|'pdf'

  • params: *

    Any parameters passed to the buildReport function from report code block

Types

# ReportResult inner

Report generation result

Properties