AnsweredAssumed Answered

Survey123 Connect: If question A is answered "yes", populate Question B with a calculation; otherwise leave it blank

Question asked by MCarey73 on May 8, 2018
Latest reply on May 8, 2018 by MCarey73

In Survey123 Connect (2.6.4) I'm struggling with getting the form to perform a calculation in a question only if I answer yes to an earlier question.


I have a select_one yes_no question ({samples}) which is "Did you take samples today?"


If the answer is yes, I would like it to generate a sample number (text, in the field sample_coll_no) which concatenates text that's already been entered by the user such as county code, target pest, and date. It has this in the calculation column: ${county}+"-"+${targetsci} ..... and so on.


So when, using the 'relevant' column, I make sample_coll_no relevant only when ${samples} = 'yes', or make the group that it's in relevant only when ${samples} = 'yes', it doesn't populate it in the form; there doesn't seem to be a triggering event that would make that happen.


If I make the 'relevant' column blank for the sample number question, it performs the calculation whether or not the "did  you take samples" question is answered yes or no. And I don't want a sample number filled out when none was taken.


I'm not sure if it makes a difference but this survey is for filling in fields in a related table; the main point feature layer is trap locations and this related table is for the site visits; there will be multiple site visits for each site/trap. 


Can anyone suggest a different approach to my problem?  It seems like a somewhat standard thing that I'm trying to achieve but somehow I'm not getting there.