Let’s say you want to display the details of a custom collection you’ve created, it’ll display the order in which the data has been inputted:
{% for depr in custom.depreciations %}
| {{ depr.description }} | {{ depr.value }} |
{% endfor %}
Output:
If you want to alter the order of your forloop, you can by assigning your custom-collection to a variable and put a sort filter on it, like this (for instance ordering on the object value:
From an accounting perspective I’d expect acc 1 to be followed by 10,100 instead of 2 to be honest. Because account 10 and 100 are part of account 1, no? Or am i missing something here regarding IRIS chart of accounts?
So what we’d do here, is look at the length of a number, and assign them to specific arrays (length one is array 1, length 2 is array 2, … ). So this way you actually order looking at the length of it.
After that, you assemble one array where you can loop through it.
Is that something workable for you? Because if you expect this to oder this in every template you call upon accounts-drop, this might be way too much of a workaround.
If it’s something rare, thetn it might be workable (hence my question at the beginning if this is something specific )
Thanks for the information. In certain cases we would like adjust the standard account template to sort the details based on the values, not alphabetically on the title.
What do we need to adjust in the copy of the standard template?
Either we make the templates to be able to sort on anything, or we can indeed change our code so users can decide for themselves on which column needs to be sorted.
for now, there isn’t though… But I’ll definitely investigate this further, what the best approach would be in this.