How to pass input parameter to beforeRender
-
Hi
I playing around with jsreports and so far I like it very much. Unfortunately I am absolutely new to node.js.
I use the setup, where jsreport makes the REST call to get the data directly from the server (beforeRender). Now I have to pass a parameter from the API Call to jsreport to the beforeRender action.
To simulate this, I have made a new dataset named "params" in jsreport studio:
{"input" : "Test"}How can I use this data in the beforeRender function?
I tried this: request.data.$resources.params.input
Thx for a little jumpstart ...
Reto E.
-
You should select your data set in the
sample data
template menu.Then you can reach the data in the script using
function beforeRender(req, res, done) { console.log(req.data.myProperty) done() }
-
I selected it in the resources template menu (instead of the sample data).
Thanks again. Now I got the basics sorted out, I'm able to start playing around.
-
Great. Good luck. :)