---
title: "Automatic numbering for individuals: Circular dependency"
url: "https://openforis.support/questions/3459/automatic-numbering-for-individuals-circular-dependency"
tags: ["collect"]
status: "answered"
score: 0
answer_count: 1
asked: "2022-10-24T15:02:42"
last_activity: "2022-10-26T14:29:31"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Automatic numbering for individuals: Circular dependency

Asked by janklein on 2022-10-24

Dear OF team,

I would like to implement autonumbering for tree individuals such as in this post: https://www.openforis.support/questions/2681/start-value-for-automatic-numbering
The field 'num' containing the automatised numbering of tree individuals should not be visible in the data entry form.

I implemented two lines of code:

(1) Constant value = 1

(2) Expression = 'math:max(parent()/a_in_ind/num)+1' apply when 'count(parent()/a_in_ind) > 1'

Adding the first individual works fine but when adding a second, OF runs into the following error: 'Circular dependency found in graph for node /transect/a_in_ind[2]/num'

Thus far, my workaround is to have the 'num' field not calculated, with the very same default expression as mentioned above: 'math:max(parent()/a_in_ind/num)+1'. This works perfectly fine but leaves the 'num' field editable in the data entry, which is a possible source of error, if accidentally modified.

Thanks for any help regarding this problem.

Best,
Jan


## Answer (score 1, by Lauri (OF) on 2022-10-26)

Link: https://openforis.support/questions/3459/automatic-numbering-for-individuals-circular-dependency/3461

Dear Jan,

one option is to create a calculated attribute and use expression "idm:position()" and in properties 
uncheck "Show in entry form", and keep "Calculated only one time" checked.

regards
Lauri

> Thank you, Lauri, your solution works perfectly fine (janklein)
