---
title: "automatic numbering of the trees"
url: "https://openforis.support/questions/2644/automatic-numbering-of-the-trees"
tags: ["collect"]
status: "answered"
score: 0
answer_count: 8
asked: "2020-01-28T13:51:06"
last_activity: "2020-01-29T11:35:53"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# automatic numbering of the trees

Asked by Sabrina on 2020-01-28

Hello everybody  
In my survey there are plots with informations existing trees. On these plots new trees should be added. These should be numbered automatically. How can I generate a consecutive numbering that follows the highest number of existing trees? For example: Existing trees have the number 1-10 and the first new tree should automatically receive the number 11.  

Thanks for your advice


## Answer (score 0, by beka on 2020-01-28)

Link: https://openforis.support/questions/2644/automatic-numbering-of-the-trees/2645

Hi,

You have to write expression in "Default Value" 

math:max(parent()/tree/tree_id)+1

where tree-is Entity

tree_id - is Number attribute

best regards

beka


## Answer (score 0, by Sabrina on 2020-01-28)

Link: https://openforis.support/questions/2644/automatic-numbering-of-the-trees/2646

when I try this I get the following error message:
[RPC Fault faultString="Circular dependency found in graph for node /inventur/plot/pb[2]/baumnr_neu"


## Answer (score 0, by beka on 2020-01-28)

Link: https://openforis.support/questions/2644/automatic-numbering-of-the-trees/2647

can you tall me names of tree "Entity" and "Number attribute" from you survey?


## Answer (score 0, by Sabrina on 2020-01-29)

Link: https://openforis.support/questions/2644/automatic-numbering-of-the-trees/2649

the "Entity" is *pb* and the "Number attribut" is *baumnummer_neu*


## Answer (score 0, by beka on 2020-01-29)

Link: https://openforis.support/questions/2644/automatic-numbering-of-the-trees/2650

under baumnummer_neu, try this expression in "Default Value"

math:max(parent()/pb/baumnummer_neu)+1


## Answer (score 0, by Sabrina on 2020-01-29)

Link: https://openforis.support/questions/2644/automatic-numbering-of-the-trees/2651

Unfortunately, that doesn't work. In collect the tree number is not adjusted and in collect mobile it crashes when I add a new tree.


## Answer (score 0, by beka on 2020-01-29)

Link: https://openforis.support/questions/2644/automatic-numbering-of-the-trees/2652

see also picture example from  our survey 
![alt text][1]


  [1]: http://www.openforis.org/support/upfiles/Inked1_2321_LI.jpg


## Answer (score 0, by Sabrina on 2020-01-29)

Link: https://openforis.support/questions/2644/automatic-numbering-of-the-trees/2653

I can't explain why it's not working. I do everything the way you do it. Maybe I can send you a screenshot?
