How do I create an autoincremented index number in the root?

  • Asked
  • Active
  • Viewed 4491 times
0

Dear all, I would like an attribute "id" in the root of my survey where the value is set to the last entered value + 1. In a non-root entity, I can do that using math:parent()/tree/id + 1 But in the root I cannot make reference to parent()/ and therefore I cannot make this work. Any help will be very much appreciated. Bruno

0

Accepted answer

Thank you for this! I understand but I would still see some clear interest in having the option of an auto-incremented attribute. It would be unique if if simply I add an attribute with a short alphanumeric code identifyng the device used. Therefore I could have my entries labelled more easily S40-156, S40-157, etc. (in place of the concatenation I have to do now without auto numbered index: S40-20181128-1632, using device+date+time). I also have the issue with a child entity: e.g. I have 'specimens' as a child entity to 'plot', 'plot' being child to 'exploration event'. In 'specimen' I have to use a continued numbering and I would like the system to search for the maximum value entered in all specimens of all plots and all exploration events. Thanks a lot for your help.

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.

Menu

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.