Apply constraint on a Group of range parameters

I would like to apply a constraint on a group of range parameters that range. Each range papameter can take the value from 0 to 100%. But the total of the group should not exceed 100%

1. What is the issue? Please be detailed.

Is there an innovative solution to this?

Can I apply a constraint on a group?
Can I give a variable as the end value of a range parameter?

2. What steps can we take to reproduce this issue?

3. What have you tried to fix the issue?

4. Upload any forms or screenshots you can share publicly below.

Will the number of parameters always be the same?
Are the parameters in a repeat or just in a group?
You could use a calculate after entering all the parameters to check if the sum is less than or equal to 100.

Yes, the number of parameters will always be the same. 4 of them. The parameters should range from 0 to 100% and they should add up to a maximum of 100%

The parameters are just in one group.

I tried a few things:

  1. I tried to change the range of the second parameter based on the value of the first parameter. But the start' end and step of range widget does not take a computed variable.

  2. I gave a default value of 0 for the parameters, and computed the total and used that as a constraint in next parameter. The error came when I hit next, but changing the previous value still gives an error. (Does not work satisfactorily). Looks like teh cnstraint is evaluated when I hit next.

Ideally What I want is the test to be applied for the whole group and the whole group of parameters are marked readjustment and reevaluation.

Any elegent and user friendly solution?

Pasting the group

Can you send the xlsform?

FarmingPracticesApp_test.xlsx (169.4 KB)

Attached...

Thanks

Prabhakar

You say "hit next" so I guess this is not the complete form.
I tested in Enketo and with your form if the total is over 100 when I hit submit all the variable become red (error).
I've added a note that appears when total is over 100, and then if you try to submit, only the note is marked as error, so you can then fix the other values. Will that work for you?
FarmingPracticesApp_test.xlsx (161.7 KB)

1 Like

Yes, what you suggest is a reasonable solution. Thanks.

But structurally,

  1. It will be good have variables in the range widget
  2. It will be good if there is a contraint in a group.

Thanks

Prabhakar