Account collection

Hi,
I’m trying to get the value of a selected account using an account collection.

Here’s my code:

Selecteer hier de rekening geboekte waardevermindering: {% input custom.rekeningen.vw as:account_collection range:'5' accounts_var:vw %}{% for rekeningen in vw %}{{ rekeningen.number }} {{ rekeningen.name }} {{ rekeningen.value | currency }}{% assign vwrek = rekeningen.value %}{% endfor %}

In the template the selection box stays empty

When I add a default account or account range the selection automatically takes the values of the range.

Can you help me out?

Hello @Wim,

Try removing your two ’ before and after the number in your range: selection. If you do that, your selection box will not be empty anymore but it will give you the option to choose from all the accounts starting with 5. Your code should be like:

Selecteer hier de rekening geboekte waardevermindering: {% input custom.rekeningen.vw as:account_collection range:5 accounts_var:vw %}{% for rekeningen in vw %}{{ rekeningen.number }} {{ rekeningen.name }} {{ rekeningen.value | currency }}{% assign vwrek = rekeningen.value %}{% endfor %}

I think this will solve your problem.

Regards,
Michail

Oh damn I didn’t see that one. You only need to ‘quote’ the range when you have multiple account ranges like ‘50,51’.

Even then you just have to go with range:6,7 no quotes needed. :slight_smile: Did this solve your problem by the way?

Yes indeed this solved my problem.

Now I have an other problem. My explaned formule doesn’t work anymore.

|**Totaal**||{% unexplained $3-current_account.value | as:indicator %}**{{ $3 |currency}}**|**{{ $6 |currency}}**|**{{ $7 |currency}}**|**{{ $5 |currency}}**|**{{ $4|currency }}**|**{% unexplained $2-vwrek | as:indicator %}{{ $2 |currency }}**|

Can you adjust the template explained formule in the background of Silverfin? Template “Belegging/aandelen” like in topic Explained/Unexplained?

I will have a look at that one too. In the meantime, can you check this post about how to post your code in the community in order to be easier to read?

@Tim is the one who has to do his background magic.

@Wim I had a look at your template. The problem is that to calculate the green dots on a global level, Silverfin computes the templates based on the ‘non input’ version. That means that a line surrounded with {% ic %}{% endic %} will not be taken into account.

So this piece will not be executed when the results are calculated, meaning the accounts will not be used, and you’ll have red dots:

{%ic%}
Selecteer hier de rekening geboekte waardevermindering: {% input custom.rekeningen.vw as:account_collection range:5 accounts_var:vw %} {% for rekeningen in vw %}{{ rekeningen.number }} {{ rekeningen.name }} : {{ rekeningen.value | currency }}{% assign vwrek = rekeningen.value %}{% endfor %}
{%endic%}

The solution here is to either take the input out of the ic tags or assign the accounts var out of the ic tag, for example by doing

{% assign vw = period.accounts | range:custom.rekeningen.vw %}

Hi Tim,

The problem isn’t the unexplained one of “Waardervermindering per”.

The account explaination needs to look at the one of “Aanschafwaarde” in my case “$3-current_account.value”

|**Totaal**||{% unexplained $3-current_account.value | as:indicator %}**{{ $3 |currency}}**|**{{ $6 |currency}}**|**{{ $7 |currency}}**|**{{ $5 |currency}}**|**{{ $4|currency }}**|**{% unexplained $2-vwrek | as:indicator %}{{ $2 |currency }}**|

When I comment out the last unexplained “$2-vwrek” the template gets a green dot.

Hi Wim,

The fact that you have two unexplained tags means that Silverfin will look at both items. As the second unexplained is different from 0, it doesn’t matter what the ‘Aanschafwaarde’ one is, it will always turn out to be red.

Could you try and move it out of the comments and see if that resolves it?

Hi Tim,

Didn’t know the unexplained tags looks at all tags all the time.

Taking it outside of the ic tags solved my problem.

Thx