No input-field in forloop

Hi,

This is the code I wrote:
{% input custom.range.rekeningen_1 as:account_collection range:“6” accounts_var:rekeningen_1 %}

{% stripnewlines %}
| Rekeningnummer
| Rekeningnaam
| Bedrag
|
| {% input custom.naam.persoon_1 placeholder:“Naam” assign:persoon_1 %}
| {% input custom.naam.persoon_2 placeholder:“Naam” assign:persoon_2 %}
| {% input custom.naam.persoon_3 placeholder:“Naam” assign:persoon_3 %}
|
{% newline %}

--------
--------
----3%----
--------
--------
--------
----3%----

{% for rekening_1 in rekeningen_1 %}
{% newline %}
| {{ rekening_1.number }}
| {{ rekening_1.name }}
| {{ rekening_1.value | currency }}
|
| {% input rekening_1.percentage_persoon_1 as:percentage placeholder:“percentage” assign:rekening_1_percentage_persoon_1 %}
| {% input rekening_1.percentage_persoon_2 as:percentage placeholder:“percentage” assign:rekening_1_percentage_persoon_2 %}
| {% input rekening_1.percentage_persoon_3 as:percentage placeholder:“percentage” assign:rekening_1_percentage_persoon_3 %}
| {% assign rekening_1_totaal_percentage = rekening_1_percentage_persoon_1+rekening_1_percentage_persoon_2+rekening_1_percentage_persoon_3 %}
{% if rekening_1_totaal_percentage !=-1 %}
{% unreconciled rekening_1_totaal_percentage as:indicator %}
{% endif %}
{% endfor %}
{% fori rekening_2 in custom.rekeningen_2 %}
{% newline %}
|
| {% input rekening_2.omschrijving %}
| {% input rekening_2.bedrag as:currency%}
|
| {% input rekening_2.percentage_persoon_1 as:percentage placeholder:“percentage” assign:rekening_2_percentage_persoon_1 %}
| {% input rekening_2.percentage_persoon_2 as:percentage placeholder:“percentage” assign:rekening_2_percentage_persoon_2 %}
| {% input rekening_2.percentage_persoon_3 as:percentage placeholder:“percentage” assign:rekening_2_percentage_persoon_3 %}
| {% assign rekening_2_totaal_percentage = rekening_2_percentage_persoon_1+rekening_2_percentage_persoon_2+rekening_2_percentage_persoon_3-1 %}
{% if rekening_2_totaal_percentage !=-1 %}
{% unreconciled rekening_2_totaal_percentage as:indicator %}
{% endif %}
{% endfori %}
{% endstripnewlines %}


{% stripnewlines %}
| Omschrijving
| Totaal
| {{ persoon_1 }}
| {{ persoon_2 }}
| {{ persoon_3 }}
{% newline %}
|--------+
|----15%----
|----15%----
|----15%----
|----15%----
{% for rekening_1 in rekeningen_1 %}
{% newline %}
| {{ rekening_1.name }}
| {{ rekening_1.value | currency }}
| {% assign rekening_1_persoon_1 = rekening_1.valuerekening_1_percentage_persoon_1 %}{{ rekening_1_persoon_1 | currency }} {% $1+ rekening_1_persoon_1 %}
| {% assign rekening_1_persoon_2 = rekening_1.value
rekening_1_percentage_persoon_2 %}{{ rekening_1_persoon_2 | currency }} {% $3+ rekening_1_persoon_2 %}
| {% assign rekening_1_persoon_3 = rekening_1.valuerekening_1_percentage_persoon_3 %}{{ rekening_1_persoon_3 | currency }} {% $5+ rekening_1_persoon_3 %}
{% endfor %}
{% for rekening_2 in custom.rekeningen_2 %}
{% newline %}
| {{ rekening_2.omschrijving }}
| {{ rekening_2.bedrag | currency }}
| {% assign rekening_2_persoon_1 = rekening_2.bedrag
rekening_2.percentage_persoon_1 %}{{ rekening_2_persoon_1 | currency }} {% $2+ rekening_2_persoon_1 %}
| {% assign rekening_2_persoon_2 = rekening_2.bedragrekening_2.percentage_persoon_2 %}{{ rekening_2_persoon_2 | currency }} {% $4+ rekening_2_persoon_2 %}
| {% assign rekening_2_persoon_3 = rekening_2.bedrag
rekening_2.percentage_persoon_3 %}{{ rekening_2_persoon_3 | currency }} {% $6+ rekening_2_persoon_3 %}
{% endfor %}
{% newline %}
| Totaal per persoon:
|
| {% assign totaal_persoon_1 = $1+$2 %}{{ totaal_persoon_1 | currency }}
| {% assign totaal_persoon_2 = $3+$4 %}{{ totaal_persoon_2 | currency }}
| {% assign totaal_persoon_3 = $5+$6 %}{{ totaal_persoon_3 | currency }}
{% endstripnewlines %}

I don’t get the input-fields on the first forloop from line 21 till 34. How can I solve this problem?

Kind regards,
Loïc

Hi @Loic_Cogels ,

When looping over the accounts_var, you’re actual looping over accounts, which means in each iteration rekening_1 is a specific account of that collection.

If you want to add input fields related to this account, you will need to add the custom drop (see here). After updating your code it can look like this:

...
{% for rekening_1 in rekeningen_1 %}
  ...
  | {% input rekening_1.custom.percentage_persoon_1 as:percentage placeholder:“percentage” assign:rekening_1_percentage_persoon_1 %}
  | {% input rekening_1.custom.percentage_persoon_2 as:percentage placeholder:“percentage” assign:rekening_1_percentage_persoon_2 %}
  ...
{% endfor %}

I hope this clarifies your question.

Kind regards,
Michil

@Michiel when doing so I get the following liquid error:

  • Liquid error: Custom values must have a key “rekening_1.custom.percentage_persoon_1” in code: input rekening_1.custom.percentage_persoon_1 as:percentage placeholder:"percentage" assign:rekening_1_percentage_persoon_1
  • Liquid error: Custom values must have a key “rekening_1.custom.percentage_persoon_2” in code: input rekening_1.custom.percentage_persoon_2 as:percentage placeholder:"percentage" assign:rekening_1_percentage_persoon_2
  • Liquid error: Custom values must have a key “rekening_1.custom.percentage_persoon_3” in code: input rekening_1.custom.percentage_persoon_3 as:percentage placeholder:"percentage" assign:rekening_1_percentage_persoon_3

Oh sorry @Loic_Cogels !

A custom variable indeed always has a namespace and a key, so the variables above are missing one level. A possible solution here is to add a dot inbetween percentage and persoon.

...
{% for rekening_1 in rekeningen_1 %}
  ...
  | {% input rekening_1.custom.percentage.persoon_1 as:percentage placeholder:“percentage” assign:rekening_1_percentage_persoon_1 %}
  | {% input rekening_1.custom.percentage.persoon_2 as:percentage placeholder:“percentage” assign:rekening_1_percentage_persoon_2 %}
  ...
{% endfor %}

KInd regards,

Michiel