Repeat answer

Hi,

Is it possible to have the same question asked twice, but the answer for the second question is a repeat from the first question.

Simon

Hi @Francis_Simon

I'm not sure I understand your scenario.
If the second answer is the same as the first answer, why would one need to answer the second question?

If you plan to validate the answer, than you could include a constraint to answer 2 like:
.=${answer 1}

This would throw an error if the user answers the two questions differently.

I hope this helps!

Best,
Andrea

Thank you for that creative answer. That would help me.

However, I seek more clarity. How do I read an answer that was already entered?

Suppose, I enter the name of a child in the first section at the beginning of the questionnaire. Is it possible to read the same name in another section automatically in the app?

regards,
Simon

Hi @Francis_Simon,

You can recall a variable by typing ${var-name}.
e.g. if the variable you want to recall is called childname, than you would write ${childname}

The syntax is a bit different if you refer to a variable inside a repeat group.
In this case the app would get "confused", unless you specify which iteration it should consider. The command to use is:
indexed-repeat(${var-name}, ${group-name}, position)

For more info on the ODK syntax, please see: https://docs.opendatakit.org/form-repeats/?highlight=indexed%20repeat#referencing-answers-from-repeated-questions

I hope this helps!

Best,
Andrea

1 Like

Thank you for the answer. I have another question.

There is a select-multiple question and it has 3 options. If the first option is selected, then Q2 will be asked. If it is not selected, then Q3 should be asked. How to write the program? Please help.

regards,
Simon

I have found the answer myself by using not(selected(${})).