Is there a way to identify, inside a template, what recipe is used to render a report?



  • I'd like to do some conditional logic based on the type of the recipe that is used for rendering, how can I do that?
    Sorry if that was already answered in some of the blog posts but there is not good way to search them.



  • In general what are the "environment" variables and lifecycle methods that are available to me in the template? I've noticed some beforeRender stuff, is there more? Is there a single place where this is described?


  • administrators

    the lifecycle methods are only available in scripts, so the single place where that is described is the scripts docs. i would say that you should go and read all the links in the learn section to better understand what is possible before actually trying to produce a template, because you can miss something if you don't inspect the information available.

    I'd like to do some conditional logic based on the type of the recipe that is used for rendering, how can I do that?

    use an script to get the recipe used and then apply that value into the data, after that the data in your template will have that value and you can use that to do some conditions. example -> https://playground.jsreport.net/studio/workspace/S1xzlLAnG/7



  • Thank you!


Log in to reply
 

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