We can use list Range
operation, with offset
of ListSize - 1 and amount
as 1 we will get the last element of the list.
This operation is introduced in v9.24.
Just putting this here so that it would be helpful for newbies : )
If you know the sorting of the list, you could also retrieve the first item in your XPath retrieve action (instead of all) and apply sorting in a way that the last object will be the first object in your retrieve action. In that way, you don't need to look for the item in the list, you retrieve the correct object right away. GL
Hi,
This is not standard in Mendix.
Without custom action you could retrieve the list first and count the objects in the list. Do a a custom retrieve next with :amount: 1 Offset : TotalCountOfObjectsInList - 1
To use the object, you can then use the ‘head’ operation.
Have a look at Appstore app ListUtils. It does not have a straightforward ‘getLast’ but maybe the ‘Sort’ and ‘getFirst’ will get you there.
I solved this problem in a different way.
I think this is kind of “cheating”, but it works if adding an AutoNumber attribute is not a problem.
I hope there is a better way to solve this.