I have a section of my Survey123 form that is only relevant if the inspector is completing the "Full" vs. the "Simple"; however, the calculate field (q_sum) within the group is calculating even when the simple form is completed, as is the question dependent on the calculate field (behi). I do not want these fields to calculate or autofill if the "Simple" form is being completed. When completing the "Simple" none of the questions in the group appear, but in the data table a value of "0" is present for q_sum and a value of "Low" is present for behi. I have tried leaving the relevant column blank, as well as several other scenarios, and always the q_sum and behi fields are completed. Anyone have any suggestions of what I am doing wrong?

begin group | second_group | BEHI Pre-Screening: | If "Yes" to 2 or more of the following questions, perform BEHI. If not, BEHI = Low. | ${Insp_type}="Full" | ||||||||||||||||||||||||

select_one yes_no | prescrn_q1 | Does the bank exhibit less than or equal to 50% protection at the toe? | yes | All 6 BEHI Pre-screening questions must be answered. | ||||||||||||||||||||||||

select_one yes_no | prescrn_q2 | Does 50% or more of the bank exhibit an undercut of 6 inches or more? | yes | All 6 BEHI Pre-screening questions must be answered. | ||||||||||||||||||||||||

select_one yes_no | prescrn_q3 | Does 50% or more of the bank exhibit stratification where at least one layer is erodible material? | yes | All 6 BEHI Pre-screening questions must be answered. | ||||||||||||||||||||||||

select_one yes_no | prescrn_q4 | Does 50% or more of the bank have a bank height of 10 feet or more with 50% or more soil exposure? | yes | All 6 BEHI Pre-screening questions must be answered. | ||||||||||||||||||||||||

select_one yes_no | prescrn_q5 | Does 50% or more of the bank exhibit roots lacking bank soil material? | yes | All 6 BEHI Pre-screening questions must be answered. | ||||||||||||||||||||||||

select_one yes_no | prescrn_q6 | Is 50% or more of the bank void of rooted vegetation? | yes | All 6 BEHI Pre-screening questions must be answered. | ||||||||||||||||||||||||

calculate | q_sum | Sum of Questions: | ${prescrn_q1} != '' and ${prescrn_q2} != '' and ${prescrn_q3} != '' and ${prescrn_q4} != '' and ${prescrn_q5} != '' and ${prescrn_q6} != '' | number(${prescrn_q1}) + number(${prescrn_q2}) + number(${prescrn_q3}) + number(${prescrn_q4}) + number(${prescrn_q5}) + number(${prescrn_q6}) | ||||||||||||||||||||||||

text | behi | BEHI: | yes | ${prescrn_q1} != '' and ${prescrn_q2} != '' and ${prescrn_q3} != '' and ${prescrn_q4} != '' and ${prescrn_q5} != '' and ${prescrn_q6} != '' | if(${q_sum} < 2, 'Low', 'Perform BEHI') | |||||||||||||||||||||||

end group |

Hi Phil - This first option worked (didn't bother trying the 2nd option) with a couple tweaks and I changed the response to be null instead of "N/A". Here is the final code:

if(${q_sum}='', '', if(${q_sum}=0,'Low', if(${q_sum}=1,'Low', if(${q_sum}=2,'Perform BEHI', if(${q_sum}=3,'Perform BEHI', if(${q_sum}=4,'Perform BEHI', if(${q_sum}=5,'Perform BEHI',if(${q_sum}=6,'Perform BEHI','N/A') ) ) ) ) ) ) )

Thanks for your help. Just for my edification - why did it make a difference moving the if(${q_sum}='', '', to the beginning versus having it at the end?

Best,

Leila