docx-templates
docx-templates copied to clipboard
Features request: ELSE statement and comments
First, great work! This has been very useful. There are two features i'm missing to use it in a better way, like: • option to use ELSE with IF stament • tag for comments, wich disapper after the report generation
Thanks
Can you explain what you mean with the 'tag for comments' exactly? I'm afraid i dont understand.
I take that to mean comments to explain the document logic, but that can be done with standard js comments ## ! // some comment ## .I could be interpreting incorrectly though. Having ELSE option would be nice, for sure
I agreed about the ELSE statement (or a switch) which could allow a significant time gain for generation Example loop on hundred elements and having each condition are mutually exclusive (and in my case the most common is the first one) --> on each iteration the 3 conditions are evaluated which produce a lot of gapping time (in a concrete example it takes a little 2min for generate a document with these 3 conditions and about 45sec if I remove it and always do rendering case 1)
+++FOR controle IN $fiche.controles+++
+++IF $controle.enregistrement === `case 1`+++
rendering element for case 1
+++END-IF+++
+++IF $controle.enregistrement === `case 2`+++
rendering element for case 2
+++END-IF+++
+++IF $controle.enregistrement === `case 3`+++
rendering element for case 3
+++END-IF+++
+++END-FOR controle +++