Pull a previous selection and display it as text

Hello.

I do appreciate support I get here. I posted a question yesterday then upon closer inspection, found out the problem.

My current challenge is the I have a select_one question for previous grade. There are to choices JSS 1 & SSS1.

later down the form, I have another question (current class). I don’t want respondents to make mistake.

So, I want when the respondent chooses JSS1 as previous grade in the earlier select_one question, the class question should automatically be JSS2 (i.e., no need to manually select an answer)

Similarly, if the earlier selected choice is SSS1, I want the form to automatically assign SSS2 as the answer to the class question.

Thanks
IMG_20231117_081321

Welcome back to the community, @zayidhs! Maybe you could do it as outlined in this post discussed previously:

Thanks for the swift response @Kal_Lam

I don’t know if my syntax is wrong but to my understanding, if(${grade}=‘pry6’,‘jss1’,if(${grade}=‘jss3’,‘sss1’)) should be ok for what I want to do but I keep getting error during online form validation.

The error is:
Error evaluating field ‘class’ (${enrolment_info}[1]/child_info[1]/class[1]): The problem was located in Calculate expression for ${class}
XPath evaluation: cannot handle function ‘if’. Requires 3 arguments but 2 provided.
Caused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Calculate expression for ${class}
XPath evaluation: cannot handle function ‘if’. Requires 3 arguments but 2 provided.

Mannnnn after a good sleep and a clear head I realised my problem was in the parenthesis :sweat_smile: :face_with_hand_over_mouth:

This is the fix if((${grade}=’pry6’), ‘jss1’, if((${grade}=’jss3’), ‘sss1’,‘’))

Thanks @Kal_Lam for always giving support & guidance.