Hey @Andrew,
There is.
You could create a new “array” for this for each costs category like this :
{% assign cost_perc_string = "0.50|0.70|0.25|0.40|0.65" %}
So you’ll have this for instance:
{% if cost_categories_string == blank or cost_keys_string == blank %}
{% assign cost_categories_string = "Huur en huurlasten|Onderhoud en herstellingen|Leveringen en diensten|Vergoeding aan derden|Divers" %}
{% assign cost_keys_string = "huur|onderhoud|leveringen|vergoeding|divers" %}
{% assign cost_perc_string = "0.50|0.70|0.25|0.40|0.65" %}
{% endif %}
Then, you split on that array and create a new variable :
{% assign cost_perc = cost_perc_string | split:"|" %}
Now, when you forloop through the cost_categories {% for cost_category in cost_categories %}
you’ll need to create a new variable for each loop ( = cost category basically) :
{% assign perc_key = cost_perc[forloop.index0] %}
So the variable perc_key gives its value for each loop (that’s what the [forloop.index0]
does; it goes through the splitted array together with each loop of the cost categories.
In the calculation of each account number, you can create something now like this :
{% $7+input custom[account.number].beperking_2 default:perc_key %}
I use the default for obvious reason, but you can change it. The default-value of the percentage is saved not into the object custom[account.number].beperking_2
but in the register $7.
If you change the percentage, that value will be saved into that object. But that is either way saved as well into the register $7!
For each account number now, you will need to calculate with that register! After the calculation, it’s important to assign it back to zero so you can calculate with it further (if you don’t do that, for each accountnumber the value of the register gets added up) :
{% assign $7 = 0 %}
Hope this works out for you