You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current version of docxtemplater: 3.24.1
I have a usecase where I have an array of numbers such as
data = [1, 3, 5]
I have to write conditions based on both the index and the current loop value inside the loop
As per the issue #397, I believe we should be able to use the $index to write conditions for index. I tried the below code for index and it did not work on the demo site.
{#data}
{#$index === 0}
Section A
{/}
{#$index === 1}
Section B
{/}
{/}
As per the issue #535, it is explained that we can write conditions on the docx for non primitive data types inside array.
But if it is just an array of number like the above shared data how should we go about it?
I tried to write it in the following manner:
{#data}
{#. == 1}
Section A
{/}
{/}
Error given: The scope parser for the tag ". == 0" failed to compile
Hi,
Current version of docxtemplater: 3.24.1
I have a usecase where I have an array of numbers such as
I have to write conditions based on both the index and the current loop value inside the loop
As per the issue #397, I believe we should be able to use the
$index
to write conditions for index. I tried the below code for index and it did not work on the demo site.As per the issue #535, it is explained that we can write conditions on the docx for non primitive data types inside array.
But if it is just an array of number like the above shared
data
how should we go about it?I tried to write it in the following manner:
Error given:
The scope parser for the tag ". == 0" failed to compile
Actual docx :
Actual docx.docx
Generated docx:
generated (9).docx
The text was updated successfully, but these errors were encountered: