Export file - bug account original number

Hi

We are trying to create a new export file, nevertheless we are experiencing issues with printing the original account number. We’ve tried acc.original_number and it works fine If we don’t use the code in between, but if we do it doesn’t work anymore. We tried to capture it as ‘original_number’ and it also only works fine if the code underneath isn’t there. Nevertheless we are never changing this value and still it is empty.


{% capture code %}
{% capture var_newline %}
{% endcapture %}

Original account number;Mapped account number;ACR account number;ACR account name;Original account description;Mapped account description;Current year;Previous year

{% capture code %}
{% capture var_newline %}
{% endcapture %}

Original account number;Mapped account number;new account number;new account name;Original account description;Mapped account description;Current year;Previous year

{% include “parts/translations” %}
{% for acc in period.accounts.include_zeros %}
{% assign original_number = acc.original_number %}
{% comment %}Get first digit of mapped number{% endcomment %}
{% assign mapped_first_digit = acc.mapped_number | slice:0,1 %}
{% assign mapped_three_digit = acc.mapped_number | slice:0,3 %}
{% if acc.opening_value != 0 or acc.value != 0 or period.minus_1y.accounts.[acc.mapped_number].value != 0 %}
{% assign new_number = “” %}
{% capture new_range_account_numbers %}new_{{ mapped_first_digit }}account_numbers{% endcapture %}
{% for item in [new_range_account_numbers] %}
{% capture new_account_translation %}t
{{ item }}{% endcapture %}
{% capture translations %}{% locale “default” %}{% t new_account_translation %}{% endlocale %} - {% locale “fr” %}{% t new_account_translation %}{% endlocale %} - {% locale “nl” %}{% t new_account_translation %}{% endlocale %}{% endcapture %}
{% assign translations = translations | downcase %}
{% assign original_name_lower = acc.original_name | downcase %}
{% if translations contains original_name_lower %}
{% assign new_number = item %}
{% break %}
{% endif %}
{% endfor %}
{% if new_number == “” %}
{% for item in [new_range_account_numbers] %}
{% capture new_account_translation %}t_{{ item }}{% endcapture %}
{% assign new_three_digit = item | slice:0,3 %}
{% if new_three_digit == mapped_three_digit %}
{% assign new_number = item %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
{% unless new_number == “” %}
{% capture new_number_translation %}t_{{ new_number }}{% endcapture %}
{% endunless %}

{{ original_number }};{{ acc.mapped_number }};{{ new_number }};{% t new_number_translation %};{{ acc.original_name }};{{ acc.mapped_name }};{{ acc.value }};{{ period.minus_1y.accounts.[acc.mapped_number].value }}
{% endif %}

{% endfor %}

{% endcapture %}{{ code | strip_newlines | replace:“”,var_newline }}


Also if we don’t use the code in between, some original account numbers are not filled while they are in fact not empty.

Can you help us out?

Thanks!

Kind regards

Jelle

Hi @JelleBe

Can you specify what you mean with “the code in between”? Which lines are you referring to exactly?

I’ve removed the captures around the code and tried to run the rest of the code myself in a document and it seems to work well, though I’m seeing an issue with the double quotes you use, but that could also be due to copy-pasting the code here.
For example:

{% unless new_number == “” %}

should be

{% unless new_number == "" %}

KR

Romy

Hi Romy

Thank you for the quick response. The curly brackets were due to the copy paste here, because it changes to curly if I copy paste the code back in Silverfin. With ‘code in between’ I mean the 2 forloops ({% for item in [new_range_account_numbers] %})

I also noticed that it wasn’t due to the original_number, but more the place of printing the variable. When I print the original number before the 2 forloops it’s printed correctly, but then the mapped number isn’t shown.

I managed to create a workaround by adding ‘;’ before the {{ original_number }}.

I also added a semicolon before the title so the first column is completely empty. Nevertheless it is still a riddle how or why it’s making the column empty after the forloops.

Thanks!

Hi @JelleBe

I see no reason why that variable would be empty, and now that you say it’s resolved by adding additional semicolons, it for sure can’t be purely a liquid thingy.

You only encounter the issue when you generate an export (export file) right?

It’s probably something particular regarding how to write code for a csv output. I can’t say we’re experts on that.

Are you OK with the solution you’ve already found or do you need more assistance from our side?

KR

Romy

Hi Romy

this workaround works fine for now, it indeed seems to be a csv-issue. I’ll take a look myself to fix this properly, but for now it’s okay.

Thanks for the quick response!

Kind regards

Jelle