Can i modify Template/Data using javascript functions in .Net?



  • I'm trying to modify my Data before print the PDF... i wanna do something like this:

    async function beforeRender(req, res) {    
        req.data.orders = data.orders + (additional data)
    }
    

    the first thing is that i don't know how to create this operation in .Net using await rs.RenderAsync(new RenderRequest{})



  • Some reason not to do it in the c#?

    The custom script can be passed like this

    RenderAsync(new RenderRequest {
      Template = new Template {
        Scripts = new List<Script> {
           new Script() { Content = "function beforeRender()... "}
        }
      }
    })
    


  • How can i pass the actual Data in Template/Data and the data that will be concatenated it the function beforeRender and pass the result to Template/Data again to handlebars understand the new data concatenated?



  • I don't get it...

    Why don't you just prepare the data you need in the c#?
    The custom jsreport script doesn't make so much sense when you send the whole request specification in the c#.
    It is mostly used when you have a template stored inside jsreport store and want to do some calculation on the incoming data.


Log in to reply
 

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