Collect - how to set a rule - the sum of three variables cannot be more than

  • Asked
  • Active
  • Viewed 3008 times
0

Dear colleagues,

I have a technical question. I am working in setting a CE survey in Collect. I have created an multiple entity (1:N) being the key attribute the cover (forest, non forest, no data) and the the secondary attribute the % (10 classes from 10 to 100%).

I would like to add a rule that limits that the sum of the three is higher than 100%. Is there a way to do this?

Thank you beforehand and congratulations for the excellent job you are doing.

Best.

Andres.

0

Accepted answer

Dear Andres,
You could follow this steps: - define a calculated attribute to calculate the sum of all the percentage cover (define it at the same level of your multiple entity and call it 'total_cover' for example) - the type of this attribute must be Number - add a new Calculated Value Expression and write this in the expression input field: sum(MULTIPLE_ENTITY_NAME/COVERAGE_ATTR_NAME) (replace MULTIPLE_ENTITY_NAME and COVERAGE_ATTR_NAME with the right entity and attribute names)
- define a Custom validation rule in the attribute with the percentage inside the multiple entity
- write this expression: parent()/total_cover <= 100

Whenever the total coverage exceeds 100%, the user will have an error message in every coverage input field.
Many thanks,
Open Foris Team

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.