I'm working on a survey questionnaire using xlsform for ODK. Where I'm stuck: I have a questions on the from like this: 21. Are you willing to pay for the service if it was offered at $100? The answers can be either Yes, No, or Dont know. If the respondent says Yes, the next Question will need to add $20 to the previous $100 so the question should now read as: 21. Are you willing to pay for the service if it was offered at $120? This should continue until the respondent says No. How can I implement this using xlsform design?
ODK xlsform design, calculate next label value based on previous yes_no response
551 views Asked by Walu.Q At
1
I understand that you need a repeat
select_one
loop that goes until No is selected. There is a way to do that through the indefinite-repeat XLSForm.This is an application of it to your question:
Explanation:
count
variable is keeping track of how many times your form repeats your question.repeat_count
field inloop_question
states that yourrepeat
should go on if (i) therepeat
has ran zero times, or (ii) as soon as the answer "no" is registered inwilling_pay
.amount
calculates the amount you should be showing inwilling_pay
.Hope this helps.