Hi there
I’m trying to get the system to create an array, based on the available directors, but am struggling to get it to work.
Stage one is simply to add the director’s loan accounts to the array, and then call them into a table.
Because of the design of our account numbers (XXX_XX_X or XXX_X_X, where the final X refers to the director), in order to separate the accounts by director, I cannot use the normal account selection methods.
{% assign loopno = 1 | integer %}
{% capture dir_no %}dir{{ loopno }}{% endcapture %}
{% assign dir_acc = period.accounts | range:'727_1_1.' %}
{% for acc in dir_acc %}{% assign custom.[dir_no].bfwd = custom.[dir_no].bfwd + acc.value %}{% endfor %}
{% for acc in dir_acc %}{% assign custom.other.bfwd = custom.other.bfwd + acc.value %}{% endfor %}
{% assign loopno = 2 | integer %}
{% capture dir_no %}dir{{ loopno }}{% endcapture %}
{% assign dir_acc = period.accounts | range:'727_1_2.' %}
{% for acc in dir_acc %}{% assign custom.[dir_no].bfwd = custom.[dir_no].bfwd + acc.value %}{% endfor %}
{% for acc in dir_acc %}{% assign custom.other2.bfwd = custom.other2.bfwd + acc.value %}{% endfor %}
{% for loopnew in (1..2) %}
{% capture dir_no %}dir{{ loopnew }}{% endcapture %}
Director {{ loopnew }}
{{ custom.[dir_no].bfwd }}
{{ custom.other.bfwd }} - dir 1
{{ custom.other2.bfwd }} - dir 2
{% endfor %}
**SECOND TRY**
{% for item in (1..5) %}
{% capture some %}dir{{ item }}{% endcapture %}
{% assign custom.[some].bf = period.accounts | range:'727_1_1.'' %}
{% assign custom.[some].cap = period.accounts | range:'727_1_2.'' %}
{% assign custom.[some].draw = period.accounts | range:'727_1_21.'' %}
{% endfor %}
{% stripnewlines %}
|director
{% for item in (1..5) %}
{% capture some %}dir{{ item }}{% endcapture %}
|{{ some }}
{% endfor %}
{% newline %}
|Brought forwards
{% for item in (1..5) %}
{% capture some %}dir{{ item }}{% endcapture %}
{% assign $1 = 0 %}
{% for acc in custom.[some].bf %}{% assign $1 = $1 + acc.value %}{% endfor %}
|{{ $1 }}
{% endfor %}
{% newline %}
{% endstripnewlines %}
Attempting this results in
However the b/fwd acount 727_1_1.000 (director 1) actually contains £-3.45, and account 727_1_2.000 (director 1) actually contains around £-15,000.
Please help me understand why the array in either attempt does not work?