I’m trying to create a simple loop, where I would like a piece of code to loop X amount of times, based on a number selected in a drop-down field by the user. For example:
{% stripnewlines %}
{% t "Select number of rows:" %}{% input custom.some.thing as:select options:"1|2|3|4|5" %}
{% newline %}
{% input custom.input.row1 placeholder:"Enter text here" %}
{% endstripnewlines %}
If the user selects ‘4’, I would like the custom.input.row1 line to loop four times to create:
custom.input.row1
custom.input.row2
custom.input.row3
custom.input.row4
How can I achieve this, and have the key of my drop.name_space.key increment by one as indicated above?
Just following up on this and was wondering whether you may be able to help with a related issue. I’ve entered my code into a {% for item in (1..x) %} loop, but I seem to have conflicting {% ic %} statements in my code:
{% for number in (1..x) %}
{% newline %}
{% ic %}
<br>
_{% t "Section" %} {{number}}_
{% newline %}
{% input custom.section[number].title_boolean as:boolean %} *{% t "Tick to include title" %}*
{% newline %}
{% endic %}
{% if custom.section[number].title_boolean == true %}
{::font size="m"}**{% input custom.section[number].title placeholder:"Title" %}**{:/font}
{% newline %}
{% endif %}
{% input custom.section[number].text as:text placeholder:"Please input further information"%}
{% endfor %}
I would expect the title and text to appear when printing, as they are outside of {% ic %}, but when print previewing they disappear from my template.
It is strange as that code should work fine. I have contacted our core developers and they are looking into it but in the meantime a temporary solution that seems to work is adding the following line after {% stripnewlines %}:
I think the issue might be a conflict between {% stripnewlines %}: and {% ic %} on export.
Thanks for getting back to me, @borjaGonzalez. I’ve added   into my code (directly beneath {% stripnewlines %}), though this just seems to pull through to my template as text and doesn’t resolve the issue. Is there something I am missing?
Also I think another possible issue might be the ‘tabs’ in the text, try to align the code to the left and that might solve the problem too. Something like this:
{% for number in (1..x) %}
{% newline %}
{% ic %}
<br>
_{% t "Section" %} {{number}}_
{% newline %}
{% input custom.section[number].title_boolean as:boolean %} *{% t "Tick to include title" %}*
{% newline %}
{% endic %}
{% if custom.section[number].title_boolean == true %}
{::font size="m"}**{% input custom.section[number].title placeholder:"Title" %}**{:/font}
{% newline %}
{% endif %}
{% input custom.section[number].text as:text placeholder:"Please input further information"%}
{% endfor %}
Our environment is https://bishopfleming.getsilverfin.com/. The reconciliation I’ve been referring to can currently be found as a text document titled ‘Executive Summary’ within the client: ‘zTest - Full CoA client’.
Although now, when print previewing, I can see both sections that I’ve included; however, upon running the export the first section is lost (the note that says ‘Introduction to your executive summary.’):