Automatic numbering for individuals: Circular dependency

  • Asked
  • Active
  • Viewed 1523 times
0

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

1

Accepted answer

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 janklein

Your answer

Markdown text. Shortcuts: Ctrl+B bold, Ctrl+I italic, Ctrl+K link, Ctrl+E code, Ctrl+Shift+V paste as plain text. Tab indents list items and code; press Escape, then Tab, to leave the text box.

Insert an image

Say what the image shows, for people who can't see it.

Keyboard shortcuts

Anywhere

?
Show this list
/
Search
g h
Go to the home page
g q
Go to the questions
g t
Go to the tags
g u
Go to the users
a
Ask a question

Lists of questions

j k
Next or previous question
Enter
Open the question

Question pages

j k
Next or previous post

Shortcuts never apply while you type in a text field. Members can turn them off in their preferences.