UBServerReport

Server-side Report builder
Example
// 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

UBServerReport

Methods

makeReport(reportCode, reportTypeopt, params)ReportResult static

Render report with code reportCode on the server side Report templates and creation rules are defined in ubs_report entity.
Arguments:
  1. reportCode (string|Object)  If reportCode type is Object it is a config object { code: String, type: String, params: String|Object }
  2. [reportType='html'] (string)  Possible values: 'html'|'pdf'
  3. params (*)  Any parameters passed to the buildReport function from report code block

Type Definitions

ReportResult

Report generation result
Properties:
Name Type Description
reportCode string
reportType string
incomeParams Object
reportOptions Object
reportData string|ArrayBuffer|*

Result of buildReport function execution