Addnewinputs puts new input always on top and don't sort it

Hi,

This is the code in with I use the addnewinputs

{% addnewinputs %}
{% assign voorafbetalingen = period.custom.voorafbetalingen | sort:“date” %}
{% endaddnewinputs %}

{% stripnewlines %}
{% fori voorafbetaling in voorafbetalingen %}
{% if forloop.first %}
| Datum
| VA 1 {% input custom.VA1.range as:account_collection range:“67” %}{% assign bereik_VA1 = custom.VA1.range %}{% assign VA1 = period.accounts | range:bereik_VA1 %}
| VA 2 {% input custom.VA2.range as:account_collection range:“67” %}{% assign bereik_VA2 = custom.VA2.range %}{% assign VA2 = period.accounts | range:bereik_VA2 %}
| VA 3 {% input custom.VA3.range as:account_collection range:“67” %}{% assign bereik_VA3 = custom.VA3.range %}{% assign VA3 = period.accounts | range:bereik_VA3 %}
| VA 4 {% input custom.VA4.range as:account_collection range:“67” %}{% assign bereik_VA4 = custom.VA4.range %}{% assign VA4 = period.accounts | range:bereik_VA4 %}
{% newline %}

--------
--------
--------
--------
--------

{% endif %}
{% newline %}
| {% input voorafbetaling.datum as:date placeholder:“Datum” %}
| {% $0+input voorafbetaling.VA1 as:currency placeholder:“Waarde” %}
| {% $1+input voorafbetaling.VA2 as:currency placeholder:“Waarde” %}
| {% $2+input voorafbetaling.VA3 as:currency placeholder:“Waarde” %}
| {% $3+input voorafbetaling.VA4 as:currency placeholder:“Waarde” %}
|
{% endfori %}
{% newline %}
| Totaal:
| {{ $0 | currency }}{% unreconciled VA1-$0 as:indicator %}
| {{ $1 | currency }}{% unreconciled VA2-$1 as:indicator %}
| {{ $2 | currency }}{% unreconciled VA3-$2 as:indicator %}
| {{ $3 | currency }}{% unreconciled VA4-$3 as:indicator %}
| {{ $0+$1+$2+$3 | currency }}
{% endstripnewlines %}

Attest voorafbetaling vennootschapsbelasting: {% input custom.voorafbetaling.thing as:file %}

When I put new inputs, the new input is always the first line, it never sorts on the date.
What do I do wrong?

Kind regards,
Loïc

Hi @Loic_Cogels,

Thanks for reaching out.

I’m pleased to say that you are very close to your code working as intended.

Within your addnewinput, you simply need to change sort:"date" to sort:"datum"

This is because we are sorting by the name of the variable (not the type of variable) you declare on this line >
{% input voorafbetaling.datum as:date placeholder:“Datum” %}

For your reference here is the link to the addnewinput page on our developer site: Addnewinputs

I hope this helps but feel free to come back to me if you need further assistance.

Tom