---
title: "Collect - how to set a rule - the sum of three variables cannot be more than"
url: "https://openforis.support/questions/1470/collect-how-to-set-a-rule-the-sum-of-three-variables-cannot-be-more-than"
tags: ["collect"]
status: "answered"
score: 0
answer_count: 1
asked: "2017-11-21T09:17:29"
last_activity: "2017-11-21T10:17:23"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

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

Asked by abespejo on 2017-11-21

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.


## Answer (score 0, by Stefano (OF) on 2017-11-21)

Link: https://openforis.support/questions/1470/collect-how-to-set-a-rule-the-sum-of-three-variables-cannot-be-more-than/1471

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
