Hi
For my reconciliation for the liquidation reserves i would like to ad some calculations per selected account.
In the code you’ll see below all the variables have the same name so they keep overwriting each other.
Beschikbare reserve {% input custom.reserves.accounts as:account_collection range:13 accounts_var:reserves %}
|—5%—|—5%-----|----15%--------|:----5%-------|------------7%-------|--------7%-----|–7%-----|-------7%--------|-----------------5%-----------------------|--------------5%------------|------------5%--------------------------------|----------------+{% for account in reserves %}
|{% input custom.reserves.volgnummer %} |{{account.number}}|{{account.name}}|{% input custom.account.aanslagjaar %}|{% assign $1 = -1account.value %}{{$1|currency}}|{% input custom.reserves.datumaanleg as:date %}|{% input
custom.reserves.percentage as:select options:“17%|20%” %}|{{$1|currency}}|{{ $1 |currency}}|{% input custom.reserves.uitkerenvanaf as:date %}|{% assign $2 = $1 0.05 %}{{$2|currency}}| {% assign $3 = $1-$2 %}{{$3|currency}}{%endfor%}
I’m making a logical mistake somewhere but I can’t seem to figure out how to fix it (=
Regards,
Julie
sven
February 23, 2018, 9:19am
2
Hi @Julie_Vandekerckhove ,
your code isn’t complete I’m afraid, so if it’s no problom, can you poste it again? Mind the format as well, so it’s more clear
Like this :
Beschikbare reserve {% input custom.reserves.accounts as:account_collection range:13 accounts_var:reserves %}
|—5%—|---5%-----|----15%--------|:----5%-------|------------7%-------|--------7%-----|–7%-----|-------7%--------|----5%-----|-----5%---|---5%-------|----------------+{% for account in reserves %}
|{% input custom.reserves.volgnummer %} |{{account.number}}|{{account.name}}|{% input custom.account.aanslagjaar %}|{% assign $1 = -1account.value %}{{$1|currency}}|{% input custom.reserves.datumaanleg as:date %}|{% input
custom.reserves.percentage as:select options:“17%|20%” %}|{{$1|currency}}|{{ $1 |currency}}|{% input custom.reserves.uitkerenvanaf as:date %}|{% assign $2 = $10.05 %}{{$2|currency}}| {% assign $3 = $1-$2 %}{{$3|currency}}{%endfor%}
But I think I see what the issue; the thing is, for your custom input objects, you’ll need to link it to something unique in your custom collection.
We allready know what that is: the account.number for instance.
So you’ll need to adapt your code the following :
Beschikbare reserve {% input custom.reserves.accounts as:account_collection range:13 accounts_var:reserves %}
|—5%—|---5%-----|----15%--------|:----5%-------|------------7%-------|--------7%-----|–7%-----|-------7%--------|-----------------5%-----------------------|--------------5%------------|------------5%--------------------------------|----------------+{% for account in reserves %}
|{% input custom[account.number].volgnummer %} |{{account.number}}|{{account.name}}|{% input custom[account.number].aanslagjaar %}|{% assign $1 = -1account.value %}{{$1|currency}}|{% input custom[account.number].datumaanleg as:date %}|{% input
custom[account.number].percentage as:select options:“17%|20%” %}|{{$1|currency}}|{{ $1 |currency}}|{% input custom[account.number].uitkerenvanaf as:date %}|{% assign $2 = $10.05 %}{{$2|currency}}| {% assign $3 = $1-$2 %}{{$3|currency}}{%endfor%}
Your issue was that your input custom object was the same for each iteration of the forloops, but by adding [account.number]
into your custom obect, each custom object exists on its “own” (that is to say, it’s related for each account number, which are unique in your fori loop - you can’t have twice the same number. Account.name could be an option, as well [forloop.index0] or keys
).
But we’ll go with this; more obvious.
You’re good with this @Julie_Vandekerckhove ?
1 Like
Thank you, this was what I needed
2 Likes
Hello
Would it be possible to post the latest code please? I’m just a beginner
tnx in advance!