xlsx with handlebars function

  • how can i call a function in a excel template (asset) ? ive trying called since template but it dosent work and the console show me this,

    Report "testXlsx" render failed.
    Error while executing xlsx recipe
    (because) error when evaluating engine handlebars for template anonymous
    (because) getPermision doesn't match xlsxSData - 10:19515

    if i loop through the array, they print data in file but when i trying called the function dont work

    what can i do?

  • administrators

    hi @Chago-Morales-Andrade

    the problem with your code is that you are using this syntax {{#getPermision permissions 'DISEÑO'}} to call your helper, such syntax in handlebars is called block helpers and they need to have a closing counterpart, otherwise they just throw error.

    you have two options:

    1.- you update your helper calls to be {{#getPermision permissions 'DISEÑO'}}{{/getPermision}}
    2.- you update your helpers calls to be {{getPermision permissions 'DISEÑO'}}

    the option 2 is easier, and here you have your same code updated and working with that https://playground.jsreport.net/w/bjrmatos/FzfaQhJ~

  • @bjrmatos thanks a lot, but i dont understand what happens with my excel file, i download your file and now it works, i had tried with 2 ways and nothing, thanks again

Log in to reply

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