# Calculating a scorecard

I have a question about using calculate to generate a score for each, based upon their answers to certain questions. I'm building the form in XLSform.

For the most part, the scores are generated using select_one questions with either a 'yes' or 'no' answer: we use 1 as the name (in choices) for 'yes' and 0 for 'no', then at the end we use calculate to add up the various scores (\${Q1}+\${Q2}+\${Q3} ... etc). In addition, in some select_multiple select questions you get a point for each choice you select: we then use count-selected to get a score for that question.

All that works fine. But I now have two problems:

(1) We have a select_multiple question where although there are 8 choices, only two of those choices generate a point each for the scorecard. How can this be done? With selected-at, or substr?

(2) We have a select_one question with three choices: the best answer is worth two points, but the other two are worth one each. But if I was to use the select_one method described above, I'd have two answers with the name '1', which can't be done. So what's another way this could be done?

I have looked closely at the bindings page, however I don't know how to do XML ...

John,

Use intermediate prompts with calculates that get filled with whatever
value if a particular select has been chosen. If that choice has not
been made, then the value is 0.

Assuming you are using XLSForm, those calculates would look something like this:

# favorite is red. value of this choice is 1

int(if((\${favorite_color}='red'),1,0))

# favorite is yellow. value of this choice is 2

int(if((\${favorite_color}='yellow'),2,0))

Once you do that, you can sum up those intermediate prompts with those
values and get the points.

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, professional support, custom reporting, and software development for ODK.

On Sun, Sep 22, 2013 at 7:26 AM, John B johnbreusch@yahoo.com.au wrote:

I have a question about using calculate to generate a score for each, based upon their answers to certain questions. I'm building the form in XLSform.

For the most part, the scores are generated using select_one questions with either a 'yes' or 'no' answer: we use 1 as the name (in choices) for 'yes' and 0 for 'no', then at the end we use calculate to add up the various scores (\${Q1}+\${Q2}+\${Q3} ... etc). In addition, in some select_multiple select questions you get a point for each choice you select: we then use count-selected to get a score for that question.

All that works fine. But I now have two problems:

(1) We have a select_multiple question where although there are 8 choices, only two of those choices generate a point each for the scorecard. How can this be done? With selected-at, or substr?

(2) We have a select_one question with three choices: the best answer is worth two points, but the other two are worth one each. But if I was to use the select_one method described above, I'd have two answers with the name '1', which can't be done. So what's another way this could be done?

I have looked closely at the bindings page, however I don't know how to do XML ...

## --

You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.

Thanks so much Yaw. That's just the fix I was looking for.

··· On Sunday, September 22, 2013 11:26:15 PM UTC+9, John B wrote: > > I have a question about using calculate to generate a score for each, > based upon their answers to certain questions. I'm building the form in > XLSform. > > For the most part, the scores are generated using select_one questions > with either a 'yes' or 'no' answer: we use 1 as the name (in choices) for > 'yes' and 0 for 'no', then at the end we use calculate to add up the > various scores (\${Q1}+\${Q2}+\${Q3} ... etc). In addition, in some > select_multiple select questions you get a point for each choice you > select: we then use count-selected to get a score for that question. > > All that works fine. But I now have two problems: > > (1) We have a select_multiple question where although there are 8 choices, > only two of those choices generate a point each for the scorecard. How can > this be done? With selected-at, or substr? > > (2) We have a select_one question with three choices: the best answer is > worth two points, but the other two are worth one each. But if I was to use > the select_one method described above, I'd have two answers with the name > '1', which can't be done. So what's another way this could be done? > > I have looked closely at the bindings page, however I don't know how to do > XML ... > >

Hi John,

Do you mind sharing your sheet, I am trying to do a simple calculation but
I am failing to comprehend the syntax.

Thanks and Regards

Ronald Munjoma
28 N Mandela Avenue, Harare
+263775625283

Sent using a mouse-sized keyboard with feigned autocorrect intelligence.

··· On Sep 22, 2013 4:26 PM, "John B" wrote:

I have a question about using calculate to generate a score for each,
based upon their answers to certain questions. I'm building the form in
XLSform.

For the most part, the scores are generated using select_one questions
with either a 'yes' or 'no' answer: we use 1 as the name (in choices) for
'yes' and 0 for 'no', then at the end we use calculate to add up the
various scores (\${Q1}+\${Q2}+\${Q3} ... etc). In addition, in some
select_multiple select questions you get a point for each choice you
select: we then use count-selected to get a score for that question.

All that works fine. But I now have two problems:

(1) We have a select_multiple question where although there are 8 choices,
only two of those choices generate a point each for the scorecard. How can
this be done? With selected-at, or substr?

(2) We have a select_one question with three choices: the best answer is
worth two points, but the other two are worth one each. But if I was to use
the select_one method described above, I'd have two answers with the name
'1', which can't be done. So what's another way this could be done?

I have looked closely at the bindings page, however I don't know how to do
XML ...

## --

You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an