Retrieve first item in list

Hello, In my application I have up and down buttons that changes the sequence number of items in a list. How can I retrieve the first and last item in this list using retrieve by association? The first and last item needs to sent to a decision later on. 
2 answers

If you already have the objects in a List, you can look at the List Operations and use Head to get the first object in the List. To get the last is a bit trickier, but one way is to reverse the list and take the Head again.

Hope this helps.


Hi Christo

By using ‘Retrieve from database’, you can set the XPath to your desired association and then select the range ‘First’ and sort on the attribute of your choice. When you select Descending on createddatetime, you get the newest item. When you select Ascending on createddatetime, you get the oldest item. For example. You can always add an extra attribute of chose, should want to be able to manually set the order.

I hope this helps you!

Kind regards,