How to use IF conditional statement with multiple choice

I have 4 options for my question. Choosing A = 1, B = 2, C = 3 , D =4. How can I set the “IF” statement for this?

Welcome to the community, @summerywy! Maybe you will need to provide more details to your query. Could you also list the second question and try to explain what you intend to achieve with the if-statement?

Maybe with the details, the community should be able to help you out.

Hi, thanks for reminding. So basically my survey will be in 3 parts, general information, house condition, and household situation. In house condition part, I will require them to pick only one answer (as above screenshot). Each option will be 1-4 scores.

The IF-statement for house condition part:
If only 1 score option is chosen, the conclusion for this section will be 1 score (good); if any 2 score option is chosen, the conclusion for this section will be 2 score (neutral); if any 3 score option is chosen, the conclusion for this section will be 3 score (moderate); if any 4 score option is chosen, the conclusion for this section will be 4 score (unsuitable for living).

Then, in household situation part, I will also require them to pick only one answer (as screenshot below). Each option will be 1-3 scores. Later, I will want to sum up all the options’ scores chosen in this section.

The conclusion for the IF-statement (in household section) will then show:
less than or equal to 5 = good; > 5 = moderate; > 10 = bad

The conclusion for the IF-statement (for this whole survey) will then show:
<5 is good, <20 is Neutral, <40 is needed repairing ,and >50 is urgent

@summerywy, you could simply do this with the count-selected function as shown in the image below:

In the survey tab of your XLSForm:

image

In the choices tab of your XLSForm:

image

Data entry screen as seen in Enketo: when any two choices are selected

Data entry screen as seen in Enketo: when all four choices are selected

Reference XLSForm:

Composite Index.xlsx (13.1 KB)

Hi Kal, thanks for the help. However, I am trying to set only 1 answer which is 1 option selected per question. Does this works? And can I set it in Enketo?

@summerywy, if you wish the respondent to be able to select only one response, then why would you opt for a select_multiple question type? Maybe you could go with the select_one question type instead.

Sorry for the confusion, the question type is “select one”.

If it’s a select_one question type and you wish to assign a score value of 1 to 4 for a particular choice, then I would advise you to use the XML value of 1, 2, 3, and 4 respectively for the choices.

It was already XML value of 1,2,3,and 4. However, I have no idea how to make the IF conditional statement to show the scores in each section, especially in conclusion.

@summerywy, these posts discussed previously should help you answer your query:

… this too …

… and this too …

… and this too …

Thanks for the links, however right now I’m unable to save any changes in enketo. It has been showing error to save.