---
title: "Can I check the next to last item in a list of items?"
url: "https://openforis.support/questions/31/can-i-check-the-next-to-last-item-in-a-list-of-items"
tags: ["collect"]
status: "answered"
score: 0
answer_count: 1
asked: "2014-10-09T20:56:55"
last_activity: "2014-10-09T21:39:44"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Can I check the next to last item in a list of items?

Asked by Andras on 2014-10-09

Hi!

I would like to check some of the attributes of the next to last item of a list of items, e.g. recorded trees. How do I do that?

Thanks!


## Answer (score 0, by Stefano (OF) on 2014-10-09)

Link: https://openforis.support/questions/31/can-i-check-the-next-to-last-item-in-a-list-of-items/36

Suppose that you have a calculated attribute **tree_num** inside the "tree" entity using this expression: **idm:position()**; then you can select the trees from next to last item with an expression similar to this (valid for attributes defined inside the "tree" entity): **parent()/tree[tree_num > $this/parent()/tree_num]**. The expression **$this/parent()/tree_num** is used to reference the tree_num of the tree into which the attribute is defined.
Thanks.
