Create fori-loop based on value

Hi all,

I have a question that I could not solve by myself.
I have a check that requires to fill in the kind of attachment the preparers used with the declaration. The possibilities are: GEEN|204.3|275A|275C|275R|275U|276K|276N|276T|328K|328L|ANDERE.
Now when ‘GEEN’ is selected I don’t want a new line (drop down list). When nothing is selected the check is a red triangle. So to fullfill the check they have to select one of the possibilities.

Now, when something else (not ‘GEEN’) is selected, I want a fori-loop with a new possibility to select a second (and third, foirth, fifth…) attachement. But off course with the same checks (nothing selected = red triangle, ‘GEEN’ is green dot and no new possibility to select new attachement,…).

Don’t know if this is possible.

Many thanks,

Here is my code:

{% stripnewlines %}
| {% t "Bijlagen bij de aangifte" %}
{% newline %}
|----45%----
|----------+#
{% endstripnewlines %}


{% assign alginfo_checks = "Bijlage" | split:";" %}
{% assign alginfo_keys = "Bijlage" | split:";" %}
{% stripnewlines %}
{% newline %}
|----5%----
|----5%----
|----5%----
|----5%----
|----5%----
|----20%---
|----------+
{% for check in alginfo_keys %}
{% if custom.check.review == 'true' %}
  {% assign sf_show_inputs = false %}
{% endif %}
{% newline %}
| {% comment %}Below will make the templates reconciliation needed{% endcomment %}
  {% if period.custom.check56.imported == blank %}
    {% assign check56_ind = 1 %}
  {% else %}
    {% assign check56_ind = 0 %}
  {% endif %}
| {% unexplained check56_ind as:indicator %}
| {{ alginfo_checks[forloop.index0] }} 
|{% input period.custom.check56.imported as:select options:"GEEN|204.3|275A|275C|275R|275U|276K|276N|276T|328K|328L|ANDERE" %} 
|
|{% if period.custom.check56.imported == "275A" %}
 {% t "!AANGIFTE RV MEESTUREN!" %}
 {% endif %}
|{% input custom.[check].extra_info56 as:text size:mini placeholder:"Opmerkingen" %}
{% endfor %}
{% endstripnewlines %}













{% if custom.check.review == false %}
{% ifi custom.some.thing.document or custom.some.thing_57 != blank %}
{% stripnewlines %}
{% newline %}
| **{% t "Extra info" %}** 
| {% input custom.some.thing_57 as:file_collection %}
{% endstripnewlines %}
{% input custom.some.thing_57 as:text placeholder:'Eventuele verklaringsdocumenten' %}
{% endifi %}
{% else %}
{% assign sf_show_inputs = true %}
{% if custom.some.thing_57.document == blank %}
Geen verklaringsdocumenten toegevoegd
{% else %}
{% ifi custom.some.thing.document or custom.some.thing_57 != blank %}
{% stripnewlines %}
{% newline %}
| **{% t "Extra info"%}** 
| {% input custom.some.thing_57 as:file_collection %}
{% endstripnewlines %}
{% assign sf_show_inputs = false %}
{% input custom.some.thing_57 as:text placeholder:'Eventuele verklaringsdocumenten' %}
{% endifi %}
{% endif %}
{% endif %}

Hello @TomVDW,

I might misunderstand you, but the goal is to have the possibility to add multiple attachments, when a value other than “GEEN” is selected right?

Something you can easily do with this:

{% stripnewlines %}
{% input period.custom.check56.imported as:select options:"GEEN|204.3|275A|275C|275R|275U|276K|276N|276T|328K|328L|ANDERE" %}

{% unless period.custom.check56.imported == "GEEN" %}
  {% input period.custom.check56.imported_attachement as:file %}
{% endunless %}
{% endstripnewlines %}

The as:file attribute allows to add multiple attachments, so in my opinion there’s no need to create a fori-loop.
However, if you really want that you could use this:

{% fori attach in period.custom.check56_attachments %}
  {% input attach.pdf_file as:file %}
{% endfori %} 

But each loop will already have the possibility to add multiple PDF…

I guess I don’t quite get the case just yet - apologies :pensive: