Dear Openforis Team In my survey new trees shall get an automatically generated ID (1, 2, 3...). For this I created a Number Attribute field and checked "Calculated". How do I define the Expression so that the ID always rises +1. Thanks for your help, Sabrina

asked 09 Apr, 09:59

Sabrina's gravatar image

Sabrina
354
accept rate: 0%


Hi Sabrina,

checked as "Calculated" it is not necessary. In "Default Value" you have to write Expression

math:max(parent()/tree/tree_id)+1

where: "tree" is Entity name "tree_id" is Number attribute name

best regards beka

permanent link

answered 09 Apr, 11:13

beka's gravatar image

beka
1617
accept rate: 9%

Thanks Beka, that helped. Is it also possible that the numbering of the ID starts at 100? For example 101, 102...

permanent link

answered 18 Apr, 10:13

Sabrina's gravatar image

Sabrina
354
accept rate: 0%

Dear Sabrina,
In the default values section, you can define default values with conditions; you can define 2 items with this parameters:

  1. Constant: 100 - Apply if: count(parent()/tree) = 1
  2. Expression: math:max(parent()/tree/tree_num) + 1

The items defined in the default values section work like this: Collect iterates over the items defined there and when it finds an item that verifies the condition defined in the "Apply if" expression, it calculates the value to apply using the Constant field or the Expression field. If you don't specify any expression in the "Apply if" field, it means "always true" (this is why you can leave it empty only for the last item, otherwise the other items won't ever be evaluated).

Thanks,
Open Foris Team

permanent link

answered 18 Apr, 11:03

OF%20Collect's gravatar image

OF Collect ♦♦
2.6k8
accept rate: 21%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×341

question asked: 09 Apr, 09:59

question was seen: 298 times

last updated: 18 Apr, 11:03