Detail "Huur gebouwen"

Hello,

I made a change to one of our existing account template but I have a problem because when I type an amount in the new field, the program also copy this amount to the next field in the table.

This is what happens:

This is what I have in the code. Can you tell me what is wrong?

Blockquote
| | | {% for year in period.calendar_years %}{{ year.end_date | date:‘%Y’ }}|{% endfor %}{% t “Totaal” %}
|-----------------------------------------+|—|----------15%-------------:|---------15%------------:|---------15%------------------------------:|-------15%-------------:|{% fori detail in current_account.custom.details %}{% assign $30 = 0 %}
| {% t “Bedrag aan vergoeding die in het belastbaar tijdperk als beroepskost werd ingebracht” %} | {% input detail.custom.doc as:file %} | {% for year in period.calendar_years %}{% stripnewlines %}
{% if forloop.last %}{% assign drop = detail.custom.value %} {% else %}{% assign drop = detail.custom[forloop.index0] %}{% endif %}
{% case forloop.index0 %}
{% when 0 %}
{% $0+input drop as:currency placeholder:‘’ %}
{% when 1 %}
{% $10+input drop as:currency placeholder:‘’ %}
{% when 2 %}
{% $20+input drop as:currency placeholder:‘’ %}
{% endcase %}
|
{% endstripnewlines %}{% endfor %} {{ $0+$10+$20 | currency }}{% assign $1=$1+$0 %}{% assign $11=$11+$10 %}{% assign $21=$21+$20 %}{% assign $0=0 %}{% assign $10=0 %}{% assign $20=0 %}
|_ {% t “Bedrag aan de vergoeding die in het belastbaar tijdperk werd betaald of toegekend” %} | | {% for year in period.calendar_years %}{% stripnewlines %}
{% if forloop.last %}{% assign drop2 = detail.custom.bedrag %} {% else %}{% assign drop2 = custom.bedrag[forloop.index] %}{% endif %}
{% comment %}{% if forloop.last %}{% assign drop2 = custom.bedrag.value %}{% else %}{% assign drop2 = custom.bedrag[forloop.index] %}{% endif %} {% endcomment %}
{% case forloop.index0 %}
{% when 0 %}
{% $2+input drop2 as:currency placeholder:‘’ %}
{% when 1 %}
{% $22+input drop2 as:currency placeholder:‘’ %}
{% when 2 %}
{% $23+input drop2 as:currency placeholder:‘’ %}
{% endcase %}
|
{% endstripnewlines %} {% endfor %} {{ $2+$22+$23 | currency }}{% assign $2=0 %}{% assign $22=0 %}{% assign $23=0 %}{% endfori %}
|
|
{% t “Totaal” %} | |{% for year in period.calendar_years %}{% case forloop.index0 %}{% when 0 %}{{ $1 | currency }}{% when 1 %}{{ $11 | currency }}{% when 2 %}{{ $21 | currency }}{% endcase %}|{% endfor %}{{ $1+$11+$21 | currency }}{% unreconciled current_account.value-($11+$21+$1) %}_|
Blockquote

Thanks a lot,

Sylvi

Hi @svalais

You have a fori collection, but the specific input you’re referring to is not tied to that collection.
That’s why it’s always exactly the same one, instead of a new one that’s tied to each iteration.

For example, your input that is tied to the custom collection (fori):

{% assign drop2 = detail.custom.bedrag %} 

versus one that is not tied to the fori, therefor is always repeating exactly the same one

{% assign drop2 = custom.bedrag.value %}

Hope that’s clear,
kind regards

Romy

Hi Romy,

Sorry but it is not clear for me and I also not find the solution.

Can you say me how to change the following line to have a correct working:

{% if forloop.last %}{% assign drop2 = detail.custom.bedrag %} {% else %}{% assign drop2 = custom.bedrag[forloop.index] %}{% endif %}

Thanks a lot,

Sylvie

Hi @svalais

You’ll need to change the name of the input, specifically it has to also start with “detail.”

So this one is already working:

{% assign drop2 = detail.custom.bedrag %} 

and this one you’ll need to change to also start with “detail.”

{% assign drop2 = custom.bedrag.value %}

So for example, changing it to the following, will fix the issue:

{% assign drop2 = detail.custom.bedrag %}

Kind regards,
Romy

Hi Romy,

I did following change but the problem is not solved:

Blockquote
{% if forloop.last %}{% assign drop2 = detail.custom.bedrag %}{% else %}{% assign drop2 = custom.bedrag[forloop.index0] %}{% endif %}

I think the problem is more in

Blockquote

{% assign drop2 = custom.bedrag[forloop.index0] %}

But I don’t how to fix it.

Thanks a lot,

Sylvie

Hi @svalais

I would suggest the following to fix this piece of code:

{% if forloop.last %}{% assign drop2 = detail.custom.bedrag %}{% else %}{% capture bedrag_key %}bedrag_{{ forloop.index0 }}{% endcapture %}{% assign drop2 = detail.custom.[bedrag_key] %}{% endif %} 

Let me know if you need more assistance,
Kind regards,
Romy