Page 1 of 1

Velocity #foreach on a sorted foundset

PostPosted: Fri Aug 06, 2021 7:02 am
by roddy
I am sorting a foundset and writing these to a related foundset that will be used in the printed Velocity. The sort order of the related foundset is getting lost in the report.

It is quite a complex sorting algorithm; I could add a simpler sort column in the printing foundset but I cannot figure out how to get the #foreach in the Velocity template to utilise a sorted order.

Any help would be much appreciated, thanks.

Re: Velocity #foreach on a sorted foundset

PostPosted: Fri Aug 06, 2021 9:25 am
by roddy
For anyone else finding this; I had to sort the original foundset; then I looped through each to write it to the foundset for the printing with the index as a sort_order column in the printing foundset. Once saved, I sort the printing foundset using the sort_order column and this then renders in the correct order.