---
title: "expression: getting attribute value from the previous tree"
url: "https://openforis.support/questions/688/expression-getting-attribute-value-from-the-previous-tree"
tags: ["collect"]
status: "answered"
score: 1
answer_count: 1
asked: "2016-08-30T13:10:49"
last_activity: "2016-08-30T13:47:12"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# expression: getting attribute value from the previous tree

Asked by Lauri (OF) on 2016-08-30

Hello,

I have 'tree' entity and I want to get for the (code) attribute 'tree_segment' by default the same value that was given to the previous tree, starting from tree no 2. What's the correct expression?

BR Lauri


## Answer (score 1, by Stefano (OF) on 2016-08-30)

Link: https://openforis.support/questions/688/expression-getting-attribute-value-from-the-previous-tree/689

Hi Lauri,  
You can access the previous tree information in this way:  

    parent()/tree[idm:position($this/parent()) - 1]/tree_segment

Don't forget to specify the condition, that must be:  

    idm:position($this/parent()) > 1

Thanks.  
Open Foris Team
