AnsweredAssumed Answered

Problem in Survey123 basing default value of one question on condition of another

Question asked by nbanerjee on Jul 16, 2017
Latest reply on Jul 17, 2017 by mbrueningesi

Hello,

 

I have an annoying issue in Survey123 that seem should be basic.  I am trying to populate the default "answer" (value) of one question based on an answer to a previous question.  In my case the first question (Q1)  is "Structure1_Type", which is a 'select_one' question.  The second question (Q2) that I am trying to populate default answer based on answer given to first question is "Structure1_Material", which is also a 'select_one' question.  Both questions are in a nested group named "Structure 1".

 

Basically, if user selects the a type="ABC" in Q1, I want default answer for Q2 to be "Metal", otherwise I want it to be "Concrete".  The conditional expression I am using is:

if(${Structure1_Type}='ABC', 'Metal', 'Concrete')

 

Initially I tried putting that expression into the 'Calculation'.  It does not give an error, but most of the questions in the Structure 1 group (i.e. Q1 and Q2 are no longer on the form).  If I put the expression in the default field, instead of showing the answer in Q2, it shows a greyed out copy of my expression with a line through it (suggestion expression is invalid). 

 

I even tried adding a separate note field named "kmeMaterial" and putting the calculation there first and then referencing it in the default field of Q2.  Interestingly, the value populates correctly in "kmeMaterial" but it gives the same greyed out expression with line in Q2 (where I want to actually store the permanent answer).

 

Attached is a screenshot that shows how the last trial looks in Survey123 Connect.  As you can see, "kmeMaterial" correctly shows an answer of 'Metal', however, the "Structure 1: Material" (i.e. Q2) has the issue.

 

I want to use similar logic in multiple places in my form, so this issue is hampering thing quite a bit. 

 

Any help/suggestions would be greatly appreciated!

 

Thanks

Neal

 

Survey123 Connect with Error

Attachments

Outcomes