Counting items backwards?

I’m using JSON to fetch a set of records. The returned data is all equal so there are no specific green fields to refer to, but there are items.
Most of the time I need the latest one so it works like so:

set LatestRecord to last item of ReceivedData

But sometimes I’d want to take the latest 10, then feed them into an operation that counts their average value as a number. If you get 50 records and want the latest 10, then item 40 of ReceivedData is the 10th most recent one only if the amount of records returned is always 50. But if the amount of records is not always 50, this doesn’t work. So is there any way to refer to items by counting them in a backwards order?

Hi,

set tenLatestRecords to items -10 thru -1 of ReceivedData

returns the last 10 items.

Thank you Stefan! So simple and it works! :cool: