- Posts: 10
- Thank you received: 0
Sum of Sub-question
- rodriguezm1
- Topic Author
- Offline
- Fresh Lemon
Less
More
5 years 2 months ago - 5 years 2 months ago #93345
by rodriguezm1
rodriguezm1 created the topic: Sum of Sub-question
Hi, I'm having an issues using the sum() command for a sub-question.
I have an array question, with 10 subquestions, and 6 answers.
the question code is: mode
each sub-question is: sq1 - sq10
and each answer is: a1-a6
On a following question, qcode "multimodal", I first try using the following code:
{if(sum(that.modes.NAOK) > 1, 'more than one', 'irrelevant')}
And it works. My QA checker gives me this:
My issue is that I don't WANT the sum of every possible thing in that question. I only want the sum of sq1. This is giving me the sum of sq1 through sq10.
OK, so I try and adjust the formula to something like this:
{if(sum(that.modes_sq1.NAOK) > 1, 'more than one', 'irrelevant')}
For some reason the code will not work. It won't expand the sum. I get the following in my QA checker
So how come the sum works for the entire question, but not for a sub-question in an array? How can I get this to work the way I want.
Again, I want the sum of the row: modes_sq1
I have an array question, with 10 subquestions, and 6 answers.
the question code is: mode
each sub-question is: sq1 - sq10
and each answer is: a1-a6
On a following question, qcode "multimodal", I first try using the following code:
{if(sum(that.modes.NAOK) > 1, 'more than one', 'irrelevant')}
And it works. My QA checker gives me this:
My issue is that I don't WANT the sum of every possible thing in that question. I only want the sum of sq1. This is giving me the sum of sq1 through sq10.
OK, so I try and adjust the formula to something like this:
{if(sum(that.modes_sq1.NAOK) > 1, 'more than one', 'irrelevant')}
For some reason the code will not work. It won't expand the sum. I get the following in my QA checker
So how come the sum works for the entire question, but not for a sub-question in an array? How can I get this to work the way I want.
Again, I want the sum of the row: modes_sq1
Last Edit: 5 years 2 months ago by rodriguezm1.
Please Log in or Create an account to join the conversation.
- rodriguezm1
- Topic Author
- Offline
- Fresh Lemon
Less
More
- Posts: 10
- Thank you received: 0
5 years 2 months ago #93346
by rodriguezm1
rodriguezm1 replied the topic: Sum of Sub-question
I was able to answer my own question.
Instead of:
{if(sum(that.modes_sq1.NAOK) > 1, 'more than one', 'irrelevant')}
I should have used:
{if(sum(that.modes.sq_sq1.NAOK) > 1, 'more than one', 'irrelevant')}
the "sq" after modes is a reserved term.
So the in general the function would be
Sum(that.questionName.sq_subquestionName.NAOK)
Instead of:
{if(sum(that.modes_sq1.NAOK) > 1, 'more than one', 'irrelevant')}
I should have used:
{if(sum(that.modes.sq_sq1.NAOK) > 1, 'more than one', 'irrelevant')}
the "sq" after modes is a reserved term.
So the in general the function would be
Sum(that.questionName.sq_subquestionName.NAOK)
Please Log in or Create an account to join the conversation.