Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested IFs in a table cell issue #369

Open
ArtVS opened this issue May 6, 2024 · 4 comments
Open

Nested IFs in a table cell issue #369

ArtVS opened this issue May 6, 2024 · 4 comments
Labels

Comments

@ArtVS
Copy link

ArtVS commented May 6, 2024

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?

@raffaele-clevermind
Copy link

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

@jjhbw
Copy link
Collaborator

jjhbw commented Jul 4, 2024

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

@jjhbw jjhbw added the triage label Jul 4, 2024
@tentone
Copy link

tentone commented Jul 10, 2024

Also have this same issue, with multiple IF

image

@xymfs
Copy link

xymfs commented Nov 8, 2024

I have the same problem. After update #340 , a lot of my documents cannot be generated!
like:

{{IF $i.result.includes('xxx')}}
{{FOR user IN $i.users}}
{{IF $user.status === true}}
{{ $user.username }}:{{$user.age}}({{userpoint.sex}})
{{END-IF}}
{{END-FOR user}}
{{END-IF}}

output:

Error: Invalid IF command nested into another IF command on the same table row: IF $user.status === true: 'undefined'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants