Automatic answer based on a previous one and calculation

Hello,

I have two questions.

First, I would like to know how to set an automatic response to a question based on a previous answer when the first one is a ‘‘select_one’’ type and the second one is an ‘‘integer’’.
Is it possible?

For instance, Q1 is :
did you ever have a miscarriage?
For which the participant may answer :

  1. Yes
  2. No
  3. Refused
    Q2 is :
    How many?
    For which the participant may answer any number from 0 to infinite.

However, it is obvious that if the person answers No to Q1 (0) than Q2 is equal to 0 … how can I code this in order to have all the answers under the same column when I export the data?

This was my first question.

The second question is :
Is it possible to merge answers, when only one of the two questions would be answered?

For instance, we have a survey that may be filled by a health professional or by the participant. However, the question would be different to lead the same answer. Hence, we would like to have one column, when we extract the data, that shows all answers.
Again, is it possible? if it is, how can we do this?

Thank you in advance,

Joannie

Hello,
Both is possible. Maybe the support articles can help you:
https://support.kobotoolbox.org/advanced_calculate.html
and https://docs.getodk.org/form-logic/?highlight=calculation#conditionally-showing-questions
Your first issue can be solved by a read_only variable of calculate type (or read_only) and a calculation (with if(…) condition.
Your last issue can be solved by an additional variable (calculate type) which will combine the two answers.

2 Likes