NReports
A simple nodejs reporting framework that leverages template runtimes for report generation.
Features
- Template Runtimes
- Jade
- Handlebars
- Datasources
- LiveJSON - JSON data embedded in the datasource
- WebJSON - JSON data provided by a RESTful web service
- Parameters
- Type - string, boolean, number
- Passed to the datasource for filtering. e.g. http://someurl?param1=:param1¶m2=:param2
Limitations
Currently the framework is only designed to work with JSON data and supports Jade or Handlebars templates.
Sample Overview
The sample illustrates using the NReports reporting engine to build a report using the a handlebars template.
Sample LiveJson datasource
var NReports = ; var params = "postalcode" "string" "6600" "country" "string" "AT" "username" "string" "demo"; var json = "postalcodes": "adminCode3":"70805""adminName2":"Politischer Bezirk Reutte""adminName3":"Breitenwang""adminCode2":"708""postalcode":"6600""adminCode1":"07""countryCode":"AT""lng":107333333"placeName":"Breitenwang""lat":474833333"adminName1":"Tirol" "adminCode3":"70806""adminName2":"Politischer Bezirk Reutte""adminName3":"Ehenbichl""adminCode2":"708""postalcode":"6600""adminCode1":"07""countryCode":"AT""lng":107"placeName":"Ehenbichl""lat":474666667"adminName1":"Tirol" "adminCode3":"70820""adminName2":"Politischer Bezirk Reutte""adminName3":"Lechaschau""adminCode2":"708""postalcode":"6600""adminCode1":"07""countryCode":"AT""lng":107"placeName":"Lechaschau""lat":474833333"adminName1":"Tirol" ; var ds = params json;
Sample Template
var NReports = ; var template = '<h1>Sample Report</h1><ul>{{#each postalcodes}}<li>{{placeName}}</li>{{/each}}</ul><h3>Report Footer here...</h3>';
Rendering the report
var NReports = ; var rpt = "sample" ; // given the sample template above var ds = rptparameters json; // given the JSON from the sample datasource above var engine = ; engine; engine;