Global Data
-
I want to have a global file that I can manipulate texts like the title of a PDF header, so that I don't have to change them one by one. I don't know if it's possible or if it's a script. Can you help?
I made an example : https://playground.jsreport.net/w/codebyarths/NrlgzvaK
-
You can implement a globaly scoped script that will add to every template additional data from a global setting.
const jsreport = require('jsreport-proxy') async function beforeRender (req, res) { const dataItem = await jsreport.documentStore.collection('data').findOne({ name: 'data-global'}) req.data.global = JSON.parse(dataItem.dataJson) }