Issue: calculation not made when using default percentages

Hi

I’m having an issue in file https://vdl.getsilverfin.com/f/1592/322403/permanent_texts/26724065.

I’ve tried to add default percentages, but then there is no calculation.

This is the code:

{% newline %}
|Aankopen van grondstoffen en bouwmaterialen
|{{ #600 | currency }}
|{% input custom.grondstoffen.variabel as:percentage default:1 %}
|{% input custom.grondstoffen.vast as:percentage default:0 %}
|{{ #600custom.grondstoffen.variabel | currency }}
|{{ #600
custom.grondstoffen.vast | currency }}

Hi Sylvia,

Giving a default value to a variable does NOT mean the object will be filled with this default value. More information on defaults you can find here: CASE: when to use placeholder, default and placeholder_default tags?

Your code needs to be changed in something like this:

{% newline %}
|Aankopen van grondstoffen en bouwmaterialen
|{{ #600 | currency }}
|{% input custom.grondstoffen.variabel as:percentage default:1 %}
|{% input custom.grondstoffen.vast as:percentage default:0 %}
{% if custom.grondstoffen.variabel == blank %}
|{{ #600*1 | currency }}
{% else %}
|{{ #600*custom.grondstoffen.variabel | currency }}
{% endif %}
{% if custom.grondstoffen.vast == blank %}
|{{ #600*0 | currency }}
{% else %}
|{{ #600*custom.grondstoffen.vast | currency }}
{% endif %}

Hi Michiel

This works, thank you!