Select to view content in your preferred language

I have built a survey with fifteen different " select_one" questions

848
4
06-26-2018 02:51 PM
BrendanMoore
New Contributor

I have built a survey with fifteen different " select_one" questions with the answers being either yes, no, or N/A. I want to add a new field to my survey that sums the number of 'no' answers from the 15 questions. Is this possible and can you show any examples? 

thank you,

Brendan

0 Kudos
4 Replies
NickDierks1
Frequent Contributor

There might be a more elegant solution to this, but this will work: start by adding 15 more questions, all hidden and null. Each of those hidden questions will have a calculation like if(selected(${Q1}, 'no'), '1', '0'). Then you have one more field that adds each of those together.

Note that hidden types are treated as text, so you should use the int() function to treat their values as numbers in the calculation!

typenamecalculationbind::esri:fieldType
select_one yes_noQ1
hiddenQ1Booleanif(selected(${Q1}, 'no'), '1', '0')null
select_one yes_noQ2
hiddenQ2Booleanif(selected(${Q2}, 'no'), '1', '0')null
select_one yes_noQ3
hiddenQ3Booleanif(selected(${Q3}, 'no'), '1', '0')null
select_one yes_noQ4
hiddenQ4Booleanif(selected(${Q4}, 'no'), '1', '0')null
textTotalNoint(${Q1Boolean}) + int(${Q2Boolean}) + int(${Q3Boolean}) + int(${Q4Boolean})
ShanaGail1
Frequent Contributor

I did something similar as Nick, except my question type was calculation and I set the esri:fieldType to null because I didn't want a field in the schema.  That's not your scenario, but if you ever want to do that, it comes in really handy.

0 Kudos
BrendanMoore
New Contributor

Thank you Nick and Shana! Really appreciate the help.

0 Kudos
ShanaGail1
Frequent Contributor

You bet! I had a lot of calculations in my Survey that I didn't want fields for, so when a release made that possible I was pretty stoked.  If you don't put null in the fieldType it will create a field for you, so you could still use a calculation question type (instead of text) if you wanted to.

0 Kudos