# Help with score calculation

Hey all,

I am stuck at the point where I need to calculate the score in the attached
Excel ODK sheet. I have 10 questions in the sheet hence the score is out of
10 marks (each question is 1 point).

I have tried the calculate function but I think the formula is wrong.
Kindly help me in getting the right formula.
In the choices tab I have highlighted the right answers in yellow meaning
if the respondent chooses that answer, then he/she gets a point (1 mark).
How do I write the formula in a way that will pick the right answer as 1
point and calculate out of 10 so that one can get 4,5,6, or whatever point
they get depending on how they answer the questions.

ODK_HAG3.xls (61.5 KB)

Hi,
if i understood correctly this example can do what you need, doesn't it?

Every option has a number value and at the end you sum the responses values.

check it on https://enketo.org/formtester

Let me know!

Angelo

example.xml (1.7 KB)

example.xls (34.5 KB)

··· Il giorno Sat Jan 24 2015 at 08:07:25 Karisa Kazungu ha scritto:

Hey all,

I am stuck at the point where I need to calculate the score in the
attached Excel ODK sheet. I have 10 questions in the sheet hence the score
is out of 10 marks (each question is 1 point).

I have tried the calculate function but I think the formula is wrong.
Kindly help me in getting the right formula.
In the choices tab I have highlighted the right answers in yellow meaning
if the respondent chooses that answer, then he/she gets a point (1 mark).
How do I write the formula in a way that will pick the right answer as 1
point and calculate out of 10 so that one can get 4,5,6, or whatever point
they get depending on how they answer the questions.

## --

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

Thanks Angelo,

I can see your form but I need you to correct the form I have attached.
That way I will understand better. And I tried using the Enketo tester but

This is the message I get when I submit the form
on http://opendatakit.org/xiframe/

Error: ODK Validate Errors: org.javarosa.xform.parse.XFormParseException:
Invalid calculate for the bind attached to "\${Score}" : Couldn't understand
the expression starting at this point: ...'1', \$Dancing?}, 0)+ /ODK_HA...
in expression count \${Favourite_movie} , if( \${Favourite_movie} '9',
\${Favourite_movie} , 0) + \${Favourite_colour} , if( \${Favourite_colour}
'7', \${Favourite_colour} , 0) + \${Dancing} , if( \${Dancing} '1', \$Dancing},
0)+ \${Born} , if( \${Born} '7', \${Born} , 0)+ \${Family_number} , if(
\${Family_number} '5', \${Family_number} , 0)+ \${Favourite_car} , if(
\${Favourite_car} '2', \${Favourite_car} , 0)+ \${Dream_house} , if(
\${Dream_house} '2', \${Dream_house} , 0)+ \${Meeting_month} , if(
\${Meeting_month} '5', \${Meeting_month} , 0)+ \${Tribe} , if( \${Tribe} '5',
\${Tribe} , 0)+ \${Games_sports} , if( \${Games_sports} '3', \${Games_sports} ,
0) >> XForm is invalid. See above for the errors. Result: Invalid

ODK_HAG3.xls (61 KB)

Hi Karisa,
i checked your calculate formula, but... i really don't understand what
you're trying to achieve with it...
It think, before create a complex formula, that we can firstly check the
login on just one variable... for example:

count \${Favourite_movie},
if(\${Favourite_movie} '9',
\${Favourite_movie}, 0)

What are you trying to represent? Do you have a question with select_one
and you have to check witch is the answer value?

Anyway in the formula there are a lot of sintax errors...the correct sintax
would be: count(nodeset).... and if(condition,do if true, do if false) for
the if... ... you can check everything here
https://opendatakit.org/help/form-design/binding/...

I suggest you to create a simple form with just 2 response and try to
experiment there ...

Bye, let me know
Angelo

··· Il giorno Sat Jan 24 2015 at 10:03:01 Karisa Kazungu ha scritto:

Thanks Angelo,

I can see your form but I need you to correct the form I have attached.
That way I will understand better. And I tried using the Enketo tester but

This is the message I get when I submit the form on
http://opendatakit.org/xiframe/

Error: ODK Validate Errors: org.javarosa.xform.parse.XFormParseException:
Invalid calculate for the bind attached to "\${Score}" : Couldn't understand
the expression starting at this point: ...'1', \$Dancing?}, 0)+ /ODK_HA...
in expression count \${Favourite_movie} , if( \${Favourite_movie} '9',
\${Favourite_movie} , 0) + \${Favourite_colour} , if( \${Favourite_colour}
'7', \${Favourite_colour} , 0) + \${Dancing} , if( \${Dancing} '1', \$Dancing},
0)+ \${Born} , if( \${Born} '7', \${Born} , 0)+ \${Family_number} , if(
\${Family_number} '5', \${Family_number} , 0)+ \${Favourite_car} , if(
\${Favourite_car} '2', \${Favourite_car} , 0)+ \${Dream_house} , if(
\${Dream_house} '2', \${Dream_house} , 0)+ \${Meeting_month} , if(
\${Meeting_month} '5', \${Meeting_month} , 0)+ \${Tribe} , if( \${Tribe} '5',
\${Tribe} , 0)+ \${Games_sports} , if( \${Games_sports} '3', \${Games_sports} ,
0) >> XForm is invalid. See above for the errors. Result: Invalid

On Saturday, January 24, 2015 at 10:30:04 AM UTC+3, Angelo Lazzari wrote:

Hi,
if i understood correctly this example can do what you need, doesn't it?

Every option has a number value and at the end you sum the responses
values.

check it on https://enketo.org/formtester

Let me know!

Angelo

Il giorno Sat Jan 24 2015 at 08:07:25 Karisa Kazungu kkar...@gmail.com ha scritto:

Hey all,

I am stuck at the point where I need to calculate the score in the
attached Excel ODK sheet. I have 10 questions in the sheet hence the score
is out of 10 marks (each question is 1 point).

I have tried the calculate function but I think the formula is wrong.
Kindly help me in getting the right formula.
In the choices tab I have highlighted the right answers in yellow
meaning if the respondent chooses that answer, then he/she gets a point (1
mark). How do I write the formula in a way that will pick the right answer
as 1 point and calculate out of 10 so that one can get 4,5,6, or whatever
point they get depending on how they answer the questions.

## --

Groups "ODK Community" group.

To unsubscribe from this group and stop receiving emails from it, send an

--
--

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

Hi Angelo,

Okay this is what I want the calculate formulla to do.

count \${Favourite_movie},
if(\${Favourite_movie} '9',
\${Favourite_movie}, 0) this means if am right that it should give a
point as 1 when the person chooses option 9 as the answer . if they choose
the other options then that should be translated as a zero point rather no
point at all.

If I had a form with questions with select_one then it would be easier to
do the calculate formula. but my questions are different. they have
select_one but with different answers. I wanted to ask all those questions
but at the same time to put a score out of 10 so that they can answer the
10 questions, each with a different answer.

Again am not that of a guru on ODK so even this - count(nodeset).... and
if(condition,do if true, do if false) will take time to understand not
unless I see it used in the excel sheet. even the other syntaxes i need to
practice. I dont know if I have elaborated well or I have compounded the
issue.

Thanks.

What are you trying to represent? Do you have a question with select_one
and you have to check witch is the answer value?

Anyway in the formula there are a lot of sintax errors...the correct sintax
would be: count(nodeset).... and if(condition,do if true, do if false) for
the if... ... you can check everything here
https://opendatakit.org/help/form-design/binding/.
https://opendatakit.org/help/form-design/binding/..

I suggest you to create a simple form with just 2 response and try to
experiment there ...

ok, i think you are missing something.

If you create a select_one response named for example "response_1" and you
put this question with this answers:

Blade Runner (choice name column = 1)
Top Gun (choice name column = 2)
Alice in wonderland (choice name column = 3)

if the user will select Top Gun the variable response_1 will contain 2, and
if he/she choose Blade Runner, the response variable response_1 will
contain 1...

the next question is:

Which is your favorite food? ( response_2 is the variable name)

Pasta (choice name column = 1)
Pizza (choice name column = 2)
Fish and Chips (choice name column = 3)

If you user check the third option the response_2 will have the 3 value...

So in another calculate field you can consider easily each value and apply
you logic, i mean for example:

if(\${response_1} = 1,'Yeah!! You like Blade Runner like me', if(\${response_1}
= 2,'ups, i don't like Top Gun','Alice in wonderland is my sun favorite'))

you can put the response_2 variable in that field too...for example:

if ( \${response_1} = 1 and \${response_2} != 3,'things...','other
things')....

is it a bit clear now?

Bye
Angelo

··· Il giorno Sat Jan 24 2015 at 19:08:45 Karisa Kazungu ha scritto:

Hi Angelo,

Okay this is what I want the calculate formulla to do.

count \${Favourite_movie},
if(\${Favourite_movie} '9',
\${Favourite_movie}, 0) this means if am right that it should give a
point as 1 when the person chooses option 9 as the answer . if they choose
the other options then that should be translated as a zero point rather no
point at all.

If I had a form with questions with select_one then it would be easier to
do the calculate formula. but my questions are different. they have
select_one but with different answers. I wanted to ask all those questions
but at the same time to put a score out of 10 so that they can answer the
10 questions, each with a different answer.

Again am not that of a guru on ODK so even this - count(nodeset).... and
if(condition,do if true, do if false) will take time to understand not
unless I see it used in the excel sheet. even the other syntaxes i need to
practice. I dont know if I have elaborated well or I have compounded the
issue.

Thanks.

What are you trying to represent? Do you have a question with select_one
and you have to check witch is the answer value?

Anyway in the formula there are a lot of sintax errors...the correct
sintax would be: count(nodeset).... and if(condition,do if true, do if
false) for the if... ... you can check everything here
https://opendatakit.org/help/form-design/binding/.
https://opendatakit.org/help/form-design/binding/..

I suggest you to create a simple form with just 2 response and try to
experiment there ...

On Saturday, January 24, 2015 at 3:49:32 PM UTC+3, Angelo Lazzari wrote:

Hi Karisa,
i checked your calculate formula, but... i really don't understand what
you're trying to achieve with it...
It think, before create a complex formula, that we can firstly check the
login on just one variable... for example:

count \${Favourite_movie},
if(\${Favourite_movie} '9',
\${Favourite_movie}, 0)

What are you trying to represent? Do you have a question with select_one
and you have to check witch is the answer value?

Anyway in the formula there are a lot of sintax errors...the correct
sintax would be: count(nodeset).... and if(condition,do if true, do if
false) for the if... ... you can check everything here
https://opendatakit.org/help/form-design/binding/...

I suggest you to create a simple form with just 2 response and try to
experiment there ...

Bye, let me know
Angelo

Il giorno Sat Jan 24 2015 at 10:03:01 Karisa Kazungu kkar...@gmail.com ha scritto:

Thanks Angelo,

I can see your form but I need you to correct the form I have attached.
That way I will understand better. And I tried using the Enketo tester but

This is the message I get when I submit the form on
http://opendatakit.org/xiframe/

Error: ODK Validate Errors: org.javarosa.xform.parse.XFormParseException:
Invalid calculate for the bind attached to "\${Score}" : Couldn't understand
the expression starting at this point: ...'1', \$Dancing?}, 0)+ /ODK_HA...
in expression count \${Favourite_movie} , if( \${Favourite_movie} '9',
\${Favourite_movie} , 0) + \${Favourite_colour} , if( \${Favourite_colour}
'7', \${Favourite_colour} , 0) + \${Dancing} , if( \${Dancing} '1', \$Dancing},
0)+ \${Born} , if( \${Born} '7', \${Born} , 0)+ \${Family_number} , if(
\${Family_number} '5', \${Family_number} , 0)+ \${Favourite_car} , if(
\${Favourite_car} '2', \${Favourite_car} , 0)+ \${Dream_house} , if(
\${Dream_house} '2', \${Dream_house} , 0)+ \${Meeting_month} , if(
\${Meeting_month} '5', \${Meeting_month} , 0)+ \${Tribe} , if( \${Tribe} '5',
\${Tribe} , 0)+ \${Games_sports} , if( \${Games_sports} '3', \${Games_sports} ,
0) >> XForm is invalid. See above for the errors. Result: Invalid

On Saturday, January 24, 2015 at 10:30:04 AM UTC+3, Angelo Lazzari wrote:

Hi,
if i understood correctly this example can do what you need, doesn't it?

Every option has a number value and at the end you sum the responses
values.

check it on https://enketo.org/formtester

Let me know!

Angelo

Il giorno Sat Jan 24 2015 at 08:07:25 Karisa Kazungu kkar...@gmail.com ha scritto:

Hey all,

I am stuck at the point where I need to calculate the score in the
attached Excel ODK sheet. I have 10 questions in the sheet hence the score
is out of 10 marks (each question is 1 point).

I have tried the calculate function but I think the formula is wrong.
Kindly help me in getting the right formula.
In the choices tab I have highlighted the right answers in yellow
meaning if the respondent chooses that answer, then he/she gets a point (1
mark). How do I write the formula in a way that will pick the right answer
as 1 point and calculate out of 10 so that one can get 4,5,6, or whatever
point they get depending on how they answer the questions.

## --

Groups "ODK Community" group.

To unsubscribe from this group and stop receiving emails from it, send

--
--

Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send

--
--

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