Hi,
I’ve used an account collection in an ic-statement.
How can I use that data outside the ic-statement when you show the preview?
Kind regards,
Loïc
Hi,
I’ve used an account collection in an ic-statement.
How can I use that data outside the ic-statement when you show the preview?
Kind regards,
Loïc
hi @Loic_Cogels,
If you created an accounts_var within ic-statement, then you cannot print it in output unless you re-created the accounts_var in output, by doing something like this:
{% assign accounts = period.accounts | range:some_selection %}
where some_selection
is the selection or the default you use in the accounts collection.
A more clear example below:
{% comment %}some needed vars{% endcomment %}
{% assign range_acc = "22__27" %}
{% assign default_acc = "22__27" %}
{% comment %}create accounts_var for input and output{% endcomment %}
{% assign selected = custom.range.accounts | default:default_acc %}
{% assign accounts = period.accounts | range:selected %}
{% ic %}{::infotext}
Select accounts here: {% input custom.range.accounts as:account_collection range:range_acc default:default_acc %}
{:/infotext}{% endic %}
{% comment %}display selected accounts{% endcomment %}
{% for acc in accounts %}
{{ acc.link }}
{% endfor %}
Note: if you use an account collection within IC-statements, you also have to do this and the use of an accounts_var becomes unnecessary.
Hope this helps?
Hi Sven,
Thank you. It works now fine!
Is it also possible if you want to so with a dropdown menu?
Sure! Do you encounter any issue with that?
Sven,
Thanks to the information above, I could make it work.
Kind regards,
Loïc