guigrpa / docx-templates

Template-based docx report creation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nested IFs in a table cell issue

ArtVS opened this issue · comments

Hi, everyone! I have the following nested IF statement in a table cell my template:
{IF $parameter.isMain == 0}{*ParameterName}{IF $parameter.unit != null}, {*ParameterUnit}{END-IF}{END-IF}{IF $parameter.isMain != 0}**{*ParameterName}{IF $parameter.unit != null}, {*ParameterUnit}{END-IF}**{END-IF}

It displays main parameter in bold and non-main parameters in regular, and should a parameter have a unit, it is displayed too.

Since version 11.5 the createReport function errors, saying nested IFs are not allowed. Is there a workaround other than rewriting without nested IFs? Or can someone add a fix for that issue in future versions, maybe?

I have the exact same issue;
templates working with previous versions now throw this error

Invalid IF command nested into another IF command on the same table row

Would like to understand what changed since I cannot find an explanation in the Changelog

I think this is due to the fix we merged for the infinite loop bug described in #340. Can you post a simple reproduction?

Also have this same issue, with multiple IF

image