Is posible know what shedule fire the script?



  • i need to use the same template, whit with different parammeters in the script based on the shedule, i need to know if it is posible.

    In my application, i have a lot of user, all need get the same report, but with they own data and with distinct frequency, i could create a template and a shedule by user, but i think that it is ugly because all templates would be same.

    ¿How could i solve that?.



  • Try to check the req parameter in the scripts beforeRender.
    You find there req.options.scheduling.schedule which I believe solves your problem.



  • Thank you very much!, that was just what I needed. I had not seen it, because it does not work in Debug mode.



  • Yes, it is more tricky. Just for your the future needs... you have two options:

    Add to script something like this

    function beforeRender(req, res) {
        console.log(JSOn.stringify(req))
    }
    

    And check jsreport console output or logs. It will be written there with debug level.

    Write serialized request to the request template content and it will be printed in your report.

    function beforeRender(req, res) {
        req.template.content = JSON.stringify(req)
    }
    

Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.