hi! you can't, at least not in the way that you are intended, you can't use a function defined in your template (script tag) as a handlebars helper, it is a different context (server side vs browser side), if you need to use something as handlebars helper you should put it in the same place that your
however you can use the
sumfunction inside the browser context (the script tag) to get a result, and then you can use that result to manipulate content in your page using the DOM
How do I access the DOM? I can't seem to use document.getElementById for example.
updated the playground. (https://playground.jsreport.net/studio/workspace/SkM6uUaeQ/3)
try to think about the execution context of the functions you have.
addfunction, which is defined as template helpers is executed in server side context, it does not have access to the DOM, that is why everything you define in template helpers can be called as handlebars helpers.
remember that jsreport executes your template to get final html (generated by your template body, helpers calls and data), and then uses that html to evaluate it in a recipe which usually is a browser (phantom, chrome), so in that part everything you have as script tags inside your html is evaluated