Repeat structure and calculations in xlsform

Hello,

I dont know if what i want to do is possible, but if you could guide me or give me hints i would greatly appreciate, i'm totally beginner with xlsforms.

I have a repeat group, in this group i ask for a percentage. There are 3 things i want :

First, in my question, i would like to show the sum of all the previous percentages entered.

Second, my total percentage should never exceed 100, that is, if for example my current percentage sum is 75%, surveyor should not be able to enter more than 25% in the current repeat index.

And last, the surveyor should not leave the repeat group as long as the total percentage has reached 100%.

Any idea or code would be helpful.

Thanks a lot.

Nicolas,

Start with a small 2-3 question form. Break up the problem into three
steps and make sure each step is correct.

  1. sum(${prompt-name}) will give you the sum of the previous values in
    ${prompt-name} while you are in in the repeat. I would put that into a
    calculate prompt called ${sum_previous_values} or something similar.

  2. Add a constraint to the prompt where you have the user enter the
    new percentage. Constrain that prompt such that ${sum_previous_values}

  • . <= 100. Remember, . is the notation for the current prompt.
  1. Best you can do here is to show a note that says the user should
    say no to adding a new repeat because they've reached 100%. And if
    they continue to go forward , then add a readonly prompt that is
    required after that. That should prevent further process and the user
    will have to go back and adjust the data.

Yaw

ยทยทยท -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Fri, Sep 5, 2014 at 10:00 AM, nicolas.poncin@gmail.com wrote:

Hello,

I dont know if what i want to do is possible, but if you could guide me or give me hints i would greatly appreciate, i'm totally beginner with xlsforms.

I have a repeat group, in this group i ask for a percentage. There are 3 things i want :

First, in my question, i would like to show the sum of all the previous percentages entered.

Second, my total percentage should never exceed 100, that is, if for example my current percentage sum is 75%, surveyor should not be able to enter more than 25% in the current repeat index.

And last, the surveyor should not leave the repeat group as long as the total percentage has reached 100%.

Any idea or code would be helpful.

Thanks a lot.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.