I've the following template:
{% set rotator = 1 %}
{% for idx in range(1, count|int + 1) %}
{% if rotator == 4 %}
{% set rotator = 1 %}
{% endif %}
{
"id": "{{ '%02d' % idx }}",
"value": "{{rotator}}"
},
{% set rotator = rotator + 1 %}
{% endfor %}
this template doesn't work because of the issue discussed here How to increment a variable on a for loop in jinja template?
For doesn't work
I mean that the rotator is always one and doesn't change.
How then could I overcome to the following issue?
The template:
The result (for
count=7
):I leave the ending
,
because you did not specify what to do with it either.