Survey123 Report Question

277
2
Jump to solution
02-18-2022 09:33 AM
AlleePrusia
New Contributor

I am trying to create a report where it will take the calculated score and classify what type of stream is formed on a site. For  example: stream is at least intermittent if ≥ 19 or perennial if ≥ 30.

I am not sure how to code this on my report so it with generate the stream determination from the calculated score. So if anyone could direct in the right direction that would be appreciated.

Thanks in advance!

0 Kudos
1 Solution

Accepted Solutions
Katie_Clark
MVP Regular Contributor

Hello! Assuming I understand your question correctly, this is very simple to do, you'll just need to use IF statements in the calculate column. 

Below is the sample syntax from the Survey123 documentation:

if(selected(${question_one}, 'yes') and selected(${question_two}, 'yes'), 'yes', 'no')

I don't know the exact field names you're using, but I think you'll just need something like this. This would be put in the calculate column for a field called "Stream_Type" or something along those lines:

if(${stream_score} >= 30, 'Perennial', if(${stream_score} >= 19, 'Intermittent', 'N/A'))

So, that syntax might not be exactly correct (it's often a little bit of trial and error to get it just right) but that just says if the stream score is greater than or equal to 30, assign the value "Perennial" to the field. If that's not true, check if stream score is greater than or equal to 19, and if so, assign the value "Intermittent". If neither of those are true, assign "N/A".

I hope that helps get you in the right direction!!

 

P.S.  I asked a question myself about nested if-statements a couple years back and I still reference it to this day for syntax help! haha

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek

View solution in original post

2 Replies
Katie_Clark
MVP Regular Contributor

Hello! Assuming I understand your question correctly, this is very simple to do, you'll just need to use IF statements in the calculate column. 

Below is the sample syntax from the Survey123 documentation:

if(selected(${question_one}, 'yes') and selected(${question_two}, 'yes'), 'yes', 'no')

I don't know the exact field names you're using, but I think you'll just need something like this. This would be put in the calculate column for a field called "Stream_Type" or something along those lines:

if(${stream_score} >= 30, 'Perennial', if(${stream_score} >= 19, 'Intermittent', 'N/A'))

So, that syntax might not be exactly correct (it's often a little bit of trial and error to get it just right) but that just says if the stream score is greater than or equal to 30, assign the value "Perennial" to the field. If that's not true, check if stream score is greater than or equal to 19, and if so, assign the value "Intermittent". If neither of those are true, assign "N/A".

I hope that helps get you in the right direction!!

 

P.S.  I asked a question myself about nested if-statements a couple years back and I still reference it to this day for syntax help! haha

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
AlleePrusia
New Contributor

Thank you so much! This worked

0 Kudos