In table 2 , I want to make the total of the amounts, based on the % filled in in table 1.
I’ve tried with if-statements, but this is not working.
Table 1:
Blockquote
{% fori detail in custom.dividenden %}
{% newline %}
|{% input detail.naam %}
|{% input detail.type as:select options:“Natuurlijk persoon|Rechtspersoon” %}
|{% $1+input detail.ontvangen_bedrag as:currency placeholder:" " %}
|{% input detail.percentage as:select options:“0|5|10|15|17|20|30” option_values:“0|0.05|0.10|0.15|0.17|0.20|0.30” %}%
|{% assign bedrag_RV = detail.ontvangen_bedrag*detail.percentage as:currency %}{% =$2+ bedrag_RV %}
{% endfori %}
{% newline %}
Table 2:
Blockquote
{% newline %}
|Belastbaar bedrag
|{% if detail.percentage == “0” %}{{ $1 }}{% endif %}
|
|
|
|
|{% if detail.percentage == “20” %}{{ $1 }}{% endif %}
|
Hi @sylvia.debaeremaeker ,
I looked over your code and it should work if you make the following changes to the tables.
Table 1
{% fori detail in custom.dividenden %}
{% newline %}
|{% input detail.naam %}
|{% input detail.type as:select options:"Natuurlijk persoon|Rechtspersoon" %}
|{% input detail.ontvangen_bedrag as:currency placeholder:" " %}
|{% input detail.percentage as:select options:"0|5|10|15|17|20|30" option_values:"0|0.05|0.10|0.15|0.17|0.20|0.30" %}% assign
|{% assign bedrag_RV = detail.ontvangen_bedrag*detail.percentage as:currency %}{{ bedrag_RV }}
{% if detail.percentage == 0 %}
{% $1+ detail.ontvangen_bedrag %}
{% elsif detail.percentage == 0.20 %}
{% $2+ detail.ontvangen_bedrag %}
{% endif %}
{% endfori %}
{% newline %}
The if-statement moved to the first table inside the loop. As you can see I used different registers $1 and $2 to differentiate between the amounts that have 0% and the ones that have 20%. Important to note here is also that the if-statement will take into account the option-values of detail.percentage (0 for 0% and 0.20 for 20%) and not the options.
In Table 2 you can then just print the registers calculated in the first table.
{% newline %}
|Belastbaar bedrag
|{{ $1 }}
|
|
|
|
|{{ $2 }}
|
I hope this was what you were looking for. Be sure to let us know if you are still having issues.
Kind regards,
Kimberly