Hi,
i’m trying to get a value ( a register) of a custom account teplate to an custom recon template.
I have used the following code:
Account template: attached to accounts beginning with 617
{% capture aanslagjaar %}{% t "aanslagjaar" %}{% endcapture %}
{% stripnewlines %}
{% fori detail in current_account.custom.details %}
{% if forloop.first %}
| {% t "Interimkantoor" %}
| {% t "Gemiddeld aantal tewerkgestelde personen" %}
| {% t "Aantal daadwerkelijk gepresteerde uren" %}
| {% t "Bijlage" %}
| {% t "Extra informatie" %}
| {% t "Bedrag" %}
{% newline %}
|---20%---
|---20%---
|---20%---
|---7%---
|---20%---
|---13%---:+#
{% endif %}
{% newline %}
| {% input detail.custom.interimkantoor %}
| {%=$1+input detail.custom.personen as:currency %}
| {%=$2+input detail.custom.uren as:currency %}
| {% input detail.custom.doc as:file size:mini %}
| {% input detail.custom.title placeholder:'extra informatie' %}
| {% $0+input detail.custom.value as:currency placeholder:'bedrag' %}
{% if forloop.last %}
{% newline %}
|**{% t "TOTAAL" %}**
|**{{ $1 |currency}}**
|**{{ $2 |currency }}**
|
|
|_^**{{ $0 | currency }}{% result 'bedrag' $0 %}**^_
{% endif %}
{% endfori %}
{% endstripnewlines %}
{% result 'personen' $1 %}
{% result 'uren' $2 %}
Code with result tag in recon template:
....
{% newline %}
{% assign aantalgewerkteureninterim = period.accounts.617.results.uren %}
{% assign geminterimfte = period.accounts.617.results.personen %}
| {% t "Interim - gem. FTE" %}
{::infotext as="hover"}
{% t "deze data wordt gebruikt in rapport *Analyse personeelskosten*" %}
{:/infotext}
|{% input custom.interfte.value | default:geminterimfte as:currency %}
{% result 'interfte' custom.interfte.value | default:geminterimfte %}
{% newline %}
| {% t "Interim - aantal gewerkte uren" %}
{::infotext as="hover"}
{% t "deze data wordt gebruikt in rapport *Analyse personeelskosten*" %}
{:/infotext}
|{% input custom.interuren.value | default:aantalgewerkteureninterim as:currency %}
{% result 'interuren' custom.interuren.value | default:aantalgewerkteureninterim %}
{% newline %}
....
I think there is something wrong with te assigning of the resulttags:
{% result 'personen' $1 %}
{% result 'uren' $2 %}
it doesn’t capture the value in register $1 and $2.
I can’t figure out why.
Hi @AlexanderDB
Thank you for your question!
We’re currently looking into this and we’ll get back to you shortly.
Best regards,
Simon
Hi @AlexanderDB,
when we do
period.accounts.617
, Liquid will always expect a collection (of accounts) to be returned, even if there is at this moment only one account that starts with 617. This means you will have to indicate you want to use the first item of that collection, so the code would change to:
{% assign aantalgewerkteureninterim = period.accounts.617.first.results.uren %}
{% assign geminterimfte = period.accounts.617.first.results.personen %}
Best regards,
Michiel
Michiel,
I don’t think this is solves te problem.
I’ve added the following in my recon template:
{% newline %}
{% assign aantalgewerkteureninterim = period.accounts.617.first.results.uren %}
{% assign geminterimfte = period.accounts.617.first.results.personen %}
| {% t "Interim - gem. FTE" %}
{::infotext as="hover"}
{% t "deze data wordt gebruikt in rapport *Analyse personeelskosten*" %}
{:/infotext}
|{% input custom.interfte.value | default:geminterimfte as:currency %}
{% result 'interfte' custom.interfte.value | default:geminterimfte %}
{% newline %}
| {% t "Interim - aantal gewerkte uren" %}
{::infotext as="hover"}
{% t "deze data wordt gebruikt in rapport *Analyse personeelskosten*" %}
{:/infotext}
|{% input custom.interuren.value | default:aantalgewerkteureninterim as:currency %}
{% result 'interuren' custom.interuren.value | default:aantalgewerkteureninterim %}
I think the problem is in capuring the value of the regiser $1 and $2.
because if I assign $1 and $2 in the account template like this:
{% endif %}
{% newline %}
| {% input detail.custom.interimkantoor %}
| {%=$1+input detail.custom.personen as:currency %}
| {%=$2+input detail.custom.uren as:currency %}
| {% input detail.custom.doc as:file size:mini %}
| {% input detail.custom.title placeholder:'extra informatie' %}
| {% $0+input detail.custom.value as:currency placeholder:'bedrag' %}
{% if forloop.last %}
{% newline %}
|**{% t "TOTAAL" %}**
|**{{ $1 |currency}}**
|**{{ $2 |currency }}**
|
|
|_^**{{ $0 | currency }}{% result 'bedrag' $0 %}**^_
{% endif %}
{% endfori %}
{% endstripnewlines %}
{% assign $1 = pers %}
{% assign $2 = ur %}
{% result 'personen' $1 %}
{% result 'uren' $2 %}
{{ $1 }} {{ pers }}
{{ $2 }} {{ ur }}
nothing is shown.
so I’m having problems capturing the registers outside the fori loop.
Hi @AlexanderDB,
What does the code below? Were the variables pers
and ur
defined before? I don’t see why you would overwrite the registers here.
Kind regards,
Michiel
Michiel,
I only wanted to check if the registers contained a value if I assigned them.
The resulttags didn’t caputer the values of the registers neither.
that’s why I added the following code to get a visual:
{{ $1 }} {{ pers }}
{{ $2 }} {{ ur }}
Hi Alexander,
the result tags didn’t capture any value because you assign an empty variable to $1 and $2 just above the lines where you create your result tag. The code below should work:
{% stripnewlines %}
{% fori detail in current_account.details %}
| {% input detail.custom.interimkantoor %}
| {%=$1+input detail.custom.personen as:currency %}
| {%=$2+input detail.custom.uren as:currency %}
| {% input detail.custom.doc as:file size:mini %}
| {% input detail.custom.title placeholder:'extra informatie' %}
| {% $0+input detail.custom.value as:currency placeholder:'bedrag' %}
{% if forloop.last %}
{% newline %}
|**{% t "TOTAAL" %}**
|**{{ $1 |currency}}**
|**{{ $2 |currency }}**
|
|
|_^**{{ $0 | currency }}{% result 'bedrag' $0 %}**^_
{% endif %}
{% endfori %}
{% endstripnewlines %}
{% result 'personen' $1 %}
{% result 'uren' $2 %}
Regards,
Michiel
Michiel,
indeed, I reversed the code for assigning.
Guess It was the end of the week then.
It works now. thanks!