I'm struggling with this 'when' statement in Survey123 XLSForm.
The form averages input from the questions to get a final score. The part I'm struggling with is converting the score to a letter grade.
I've tried many derivatives of this, or with 'if' statements. It all keeps failing.
when(${gradeSum} < 1, 'F', (${gradeSum}>= 1 and ${gradeSum} < 2), 'D', (${gradeSum}>= 2 and ${gradeSum} < 3), 'C', (${gradeSum}>= 3 and ${gradeSum} < 4), 'B','A')
I've also tried this, and it doesn't work.
if($gradeSum} < 1, 'F',
if((${gradeSum} >= 1) and (${gradeSum} < 2 ), 'D',
if((${gradeSum} >= 2) and (${gradeSum} < 3), 'C',
if((${gradeSum} >= 3) and (${gradeSum} < 4), 'B',
'A'
)
)
)
)
XLSForm attached.
Thanks in advance for your help!
Solved! Go to Solution.
I got it to work!
I realized I was missing a bracket. 😣
if(${gradeSum} < 1, 'F',
if((${gradeSum} >= 1) and (${gradeSum} < 2 ), 'D',
if((${gradeSum} >= 2) and (${gradeSum} < 3), 'C',
if((${gradeSum} >= 3) and (${gradeSum} < 4), 'B',
'A'
)
)
)
)
I got it to work!
I realized I was missing a bracket. 😣
if(${gradeSum} < 1, 'F',
if((${gradeSum} >= 1) and (${gradeSum} < 2 ), 'D',
if((${gradeSum} >= 2) and (${gradeSum} < 3), 'C',
if((${gradeSum} >= 3) and (${gradeSum} < 4), 'B',
'A'
)
)
)
)