Skip logic : is it possible to make the condition dependent on the answer in a rating question?

Hi, I have a rating question of which the last element in the question is “Other income source”. The rating scale from 1 to 5.

I then have another question to ask the respondent to specify the income source. But I only want it to be asked if “other” was given a rating of 2 or more.

I tried setting the condition as follows:

The project updates successfully, but then I get an error when I try to preview it:
There has been a problem trying to replace ${undefined} with the XPath to the survey element named ‘undefined’. There is no survey element with this name.

Is there another way to set up the skip logic?

Would you mind going through this support article Adding Skip Logic? It should help you solve your issue.

Thanks for the reply. The article does not solve my problem. I know how to add skip logic but in this particular case it is not working. Can you have a skip logic that refers to a question in a rating matrix? And if so, how should the “response” be referred to?

last element in the question is “Other income source”. The rating scale from 1 to 5.

is this question a Select One, or a Number type question, or a Range type question, …? Perhaps if you post your actual (simple?) form it’d help determine what the necessary relevant expression should be.

1 Like

The question I am trying to refer to in the skip logic is a rating question. One of the rows is “Other” and I want to use the next question (text) to specify the “other” but only when certain responses were selected in the rating question.

@sdalle, you could design the same as outlined in the xlsform as shown below:

You could design the same in the survey tab of your xlsform as follows:

Reference xlsform:

Skip in a rating scale.xlsx (10.2 KB)

You could design the same in the Form Builder UI as follows:

Step 1: Create the variable where the label for Q1 would be Q1. How likely is it that you would recommend this fruit to a friend or colleague?. Similarly, create Other with the label Other please comment.

Step 2: Then click the MANUALLY ENTER YOUR SKIP LOGIC IN XLSFORM CODE as shown in the image above in the second question under the Skip Logic.

Step 3: Then you will need to type in the code ${Q1} >= 2 as shown in the image below:

Step 4: You can now SAVE and DEPLOY.

Data entry as seen in Enketo: (when a condition is not met)

Data entry as seen in Enketo: (when a condition is met)

For details, you could also go through our support article Adding Skip Logic and User-Specified “Other” Responses for Multiple-Choice Questions.

1 Like

Thank you @Kal_Lam, it worked!