How to retrieve the last object in a list? - Mendix Forum

How to retrieve the last object in a list?

0

Hi,

In Retrieve in your Microflow you can set First as option to get the first value in your list, but how do you get the last value ? For Xpath I know that you can use last() function but I dont think this works in Mendix.

 

kr

Thomas

asked
2 answers
3

Last object depends on the sorting order, by what order do you want to get the last object?
You can set the sorting and offset options to retrieve last object.
Another way if you already have the list, sort it so that it is inverted and last object comes first. Now take the head of the list using list operation and you have the last object

answered
0

There is a list-app in the AppStore, https://marketplace.mendix.com/link/component/81827,  which grants you some more ways to handle lists. One of them being retrieving the top-n items of a list. It does not give you a way to retrieve the last item of a list, but sorting might handle that.

answered