Branching based on selection

I have a question about show selected list and continute question.
In the attached file, I want to click choice "School", it will show question of school, and when I choice "Age", it will be show question age.

Could you tell me how to do it? Thank you

Select_one_loop_question.xlsx (9.7 KB)

Could you describe your case more precisely?
I'm not sure what you want to achieve. I guess the problem is after question_2/question_3? Because I tested your form and it worked fine, if you select School in question_1 then question_2 is displayed otherwise question_3 is displayed.

Firstly, I choose School, it will show select one options. I choose an option.

Finally, I choose Age, it doesn't show options of age. This is problem.

Could you help me to fix it? Thank you

So generally you would like to display both question_1 and question_2 every time but the order should be based on the answer in the first question?
If School selected display question_2 then question_3
If Age selected display question_3 then question_2

am I right?

Yes. My goal is so. One time choose option select one, it will show question of one topic (age or school)

You were actually 99% of the way there in your original form! You just need to move the relevant calculation from the group's question onto the group itself. Try this version instead:

Select_one_loop_question.xlsx (9.8 KB)

I tried move relevant calculation to group but it is the same old :(. No change.

Did you try my attached form (eg on https://opendatakit.org/xlsform/)? I believe it does exactly what you are describing above. If not, can you please explain more. eg do you want to only ever show one question (age or school) ? or do you want to swap their order depending on the response (as @Grzesiek2010 suggested)?

I tried your form. But it's the same original display. I will explain more details.
For example:
The first screen in odk, It will show topics (Age, School). If I choose school topic, it will show question of school.
And then to next screen, school topic option will invisible, only age topic. Now, I want to show question of age topic but It doesn't show it, only go to finish form.

Ah, so you basically want to swap the order the two questions appear, depending on what the user first selects. Although you cannot change the order (ie swap) questions in a form, there are a few different ways you can accomplish the same result.

One approach would be to create two groups, duplicate and swapping the question order in each, then making sure you only display one group or the other depending on your swap condition. This is probably the simplest approach but involves duplicating your questions, which could make updating things later tedious as you must ensure both copies remain identical, and you still have to give each copy of the same question a different identifier.

Another approach that doesn't require copying questions involves putting them in a repeat group, repeating the group twice, and making sure only one question or the other is shown each repetition, again according to your swap condition:

Select_one_loop_question.xlsx (9.7 KB)

This is a bit more complicated, but has the elegance of not having to duplicate questions in your form. The 'secret sauce' here is the swap condition:

number((position(..)=1 and ${question_1}='Age') or (position(..)=2 and ${question_1}!='Age'))

this basically calculates (pos=1 XOR q1=Age) which determines whether to swap the questions in that iteration or not. The relevant condition on the two questions ensures only one or the other gets displayed.

Again, obviously more complicated, but perhaps more 'elegant'... :wink: