Can we run a pagelist loop backwards?
Let’s imagine I want to loop backwards from the sixth result in D_datapage.pxResults to the other five, four, three, two and one.
Let’s imagine I want to loop backwards from the sixth result in D_datapage.pxResults to the other five, four, three, two and one.
Hello @kulks,
Yes, we can do backward looping by customizing the loop giving -1 in the increment.
Please find the screenshot for your reference.
Regards,
Prasad
@kulks
A little hack would be sort the page list using pxListsubscript which holds the index of the page list
and loop using ForEachEmbeddedPage .
Hi @kulks
Solution provided by @pichn should work, however if you face any issue with this approach, I have another way to achieve it.
By creating a temp pagelist - Loop through your main page list and push the records into a temp page list using the method . Prepend will add a page at the top of the list and push the existing pages down.By this way the first page of your source list will become the last page of temp page list.
Use this temp pagelist for further processing and after usage you can remove it.
Note - use the PREPEND approach only if the pagelist has less number of pages.
Happy Learning!