Hi all. I have a group of fields, all Select1 types in a table-list, that
represent whether an answer is correct or incorrect. I am using XLSForm
and have coded the values (names) of the responses as 1/0 in the choices
worksheet. At the bottom of the group, I would like a running tally of the
total correct. In other words, every time a user selects 'Correct', I would
like the total at the bottom to update with the current total. I'm having
trouble getting it to work (I always get a NaN value for the total), and I
can't figure out which piece is causing the problem:

My total field is incorrectly specified. I'm using calculate =
"sum(${my_group})". I've also tried calculate = "${my_field1}+${my_field2}"
in case I didn't understand the sum syntax, but it doesn't work either.

Select1 types are stored as strings so it can't calculate a total.
Do I need to convert to integer in the constraint field for each of the
fields? I tried to enter the constraint for my_fieldX to ". <
int(${my_fieldX})", but then I get a "value not allowed" error, even though
I've coded the names as 0/1.

You can't calculate a total within a group. I read another post where
it said you can't calculate a sum for repeating fields, but I don't know if
that same limitation applies to groups. Plus, I don't think this is the
primary problem b/c I've tested it outside the group, and it still doesn't
work.

This will not work in the current ODK Collect. All evaluations are
performed when the screen is first displayed and not updated
dynamically - due to JavaRosa limitations. This will work in ODK
Survey which is based on HTML5 and is currently in alpha. Beta
release expected around mid-April.

Gaetano

···
On Wed, Mar 27, 2013 at 6:29 AM, Jeff W wrote:
> Hi all. I have a group of fields, all Select1 types in a table-list, that
> represent whether an answer is correct or incorrect. I am using XLSForm and
> have coded the values (names) of the responses as 1/0 in the choices
> worksheet. At the bottom of the group, I would like a running tally of the
> total correct. In other words, every time a user selects 'Correct', I would
> like the total at the bottom to update with the current total. I'm having
> trouble getting it to work (I always get a NaN value for the total), and I
> can't figure out which piece is causing the problem:
>
> My total field is incorrectly specified. I'm using calculate =
> "sum(${my_group})". I've also tried calculate = "${my_field1}+${my_field2}"
> in case I didn't understand the sum syntax, but it doesn't work either.
> Select1 types are stored as strings so it can't calculate a total. Do I
> need to convert to integer in the constraint field for each of the fields? I
> tried to enter the constraint for my_fieldX to ". < int(${my_fieldX})", but
> then I get a "value not allowed" error, even though I've coded the names as
> 0/1.
> You can't calculate a total within a group. I read another post where it
> said you can't calculate a sum for repeating fields, but I don't know if
> that same limitation applies to groups. Plus, I don't think this is the
> primary problem b/c I've tested it outside the group, and it still doesn't
> work.
>
> Thanks,
> Jeff
>
>
> --
> --
> Post: opendatakit@googlegroups.com
> Unsubscribe: opendatakit+unsubscribe@googlegroups.com
> Options: http://groups.google.com/group/opendatakit?hl=en
>
> ---
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

That's too bad...guess I'll just wait for Survey for that type of
functionality. Any suggestions for why the sum field outside of the group
isn't working?

Thanks,
Jeff

···
On Wednesday, March 27, 2013 11:57:46 AM UTC-5, Gaetano Borriello wrote:
>
> This will not work in the current ODK Collect. All evaluations are
> performed when the screen is first displayed and not updated
> dynamically - due to JavaRosa limitations. This will work in ODK
> Survey which is based on HTML5 and is currently in alpha. Beta
> release expected around mid-April.
>
> Gaetano
>
>
>
> On Wed, Mar 27, 2013 at 6:29 AM, Jeff W <jmw...@gmail.com > wrote:
> > Hi all. I have a group of fields, all Select1 types in a table-list,
> that
> > represent whether an answer is correct or incorrect. I am using XLSForm
> and
> > have coded the values (names) of the responses as 1/0 in the choices
> > worksheet. At the bottom of the group, I would like a running tally of
> the
> > total correct. In other words, every time a user selects 'Correct', I
> would
> > like the total at the bottom to update with the current total. I'm
> having
> > trouble getting it to work (I always get a NaN value for the total), and
> I
> > can't figure out which piece is causing the problem:
> >
> > My total field is incorrectly specified. I'm using calculate =
> > "sum(${my_group})". I've also tried calculate =
> "${my_field1}+${my_field2}"
> > in case I didn't understand the sum syntax, but it doesn't work either.
> > Select1 types are stored as strings so it can't calculate a total. Do I
> > need to convert to integer in the constraint field for each of the
> fields? I
> > tried to enter the constraint for my_fieldX to ". < int(${my_fieldX})",
> but
> > then I get a "value not allowed" error, even though I've coded the names
> as
> > 0/1.
> > You can't calculate a total within a group. I read another post where it
> > said you can't calculate a sum for repeating fields, but I don't know if
> > that same limitation applies to groups. Plus, I don't think this is the
> > primary problem b/c I've tested it outside the group, and it still
> doesn't
> > work.
> >
> > Thanks,
> > Jeff
> >
> >
> > --
> > --
> > Post: opend...@googlegroups.com
> > Unsubscribe: opendatakit...@googlegroups.com
> > Options: http://groups.google.com/group/opendatakit?hl=en
> >
> > ---
> > 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...@googlegroups.com .
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>

select1 fields are configured as string-valued fields.

So to sum up the value of several of these, you need to convert the string
to a number:

calculate="number(/data/q1)+number(/data/q2)"

···
On Wed, Mar 27, 2013 at 11:44 AM, Jeff W wrote:

That's too bad...guess I'll just wait for Survey for that type of
functionality. Any suggestions for why the sum field outside of the group
isn't working?

Thanks,
Jeff

On Wednesday, March 27, 2013 11:57:46 AM UTC-5, Gaetano Borriello wrote:

This will not work in the current ODK Collect. All evaluations are
performed when the screen is first displayed and not updated
dynamically - due to JavaRosa limitations. This will work in ODK
Survey which is based on HTML5 and is currently in alpha. Beta
release expected around mid-April.

Hi all. I have a group of fields, all Select1 types in a table-list,
that
represent whether an answer is correct or incorrect. I am using
XLSForm and
have coded the values (names) of the responses as 1/0 in the choices
worksheet. At the bottom of the group, I would like a running tally of
the
total correct. In other words, every time a user selects 'Correct', I
would
like the total at the bottom to update with the current total. I'm
having
trouble getting it to work (I always get a NaN value for the total),
and I
can't figure out which piece is causing the problem:

My total field is incorrectly specified. I'm using calculate =
"sum(${my_group})". I've also tried calculate =
"${my_field1}+${my_field2}"
in case I didn't understand the sum syntax, but it doesn't work either.
Select1 types are stored as strings so it can't calculate a total. Do
I
need to convert to integer in the constraint field for each of the
fields? I
tried to enter the constraint for my_fieldX to ". < int(${my_fieldX})",
but
then I get a "value not allowed" error, even though I've coded the
names as
0/1.
You can't calculate a total within a group. I read another post where
it
said you can't calculate a sum for repeating fields, but I don't know
if
that same limitation applies to groups. Plus, I don't think this is
the
primary problem b/c I've tested it outside the group, and it still
doesn't
work.

···
On Wed, Mar 27, 2013 at 1:40 PM, Mitch Sundt wrote:

select1 fields are configured as string-valued fields.

So to sum up the value of several of these, you need to convert the string
to a number:

calculate="number(/data/q1)+number(/data/q2)"

On Wed, Mar 27, 2013 at 11:44 AM, Jeff W jmwotw@gmail.com wrote:

That's too bad...guess I'll just wait for Survey for that type of
functionality. Any suggestions for why the sum field outside of the group
isn't working?

Thanks,
Jeff

On Wednesday, March 27, 2013 11:57:46 AM UTC-5, Gaetano Borriello wrote:

This will not work in the current ODK Collect. All evaluations are
performed when the screen is first displayed and not updated
dynamically - due to JavaRosa limitations. This will work in ODK
Survey which is based on HTML5 and is currently in alpha. Beta
release expected around mid-April.

Hi all. I have a group of fields, all Select1 types in a table-list,
that
represent whether an answer is correct or incorrect. I am using
XLSForm and
have coded the values (names) of the responses as 1/0 in the choices
worksheet. At the bottom of the group, I would like a running tally
of the
total correct. In other words, every time a user selects 'Correct', I
would
like the total at the bottom to update with the current total. I'm
having
trouble getting it to work (I always get a NaN value for the total),
and I
can't figure out which piece is causing the problem:

My total field is incorrectly specified. I'm using calculate =
"sum(${my_group})". I've also tried calculate =
"${my_field1}+${my_field2}"
in case I didn't understand the sum syntax, but it doesn't work
either.
Select1 types are stored as strings so it can't calculate a total. Do
I
need to convert to integer in the constraint field for each of the
fields? I
tried to enter the constraint for my_fieldX to ". <
int(${my_fieldX})", but
then I get a "value not allowed" error, even though I've coded the
names as
0/1.
You can't calculate a total within a group. I read another post where
it
said you can't calculate a sum for repeating fields, but I don't know
if
that same limitation applies to groups. Plus, I don't think this is
the
primary problem b/c I've tested it outside the group, and it still
doesn't
work.

Thanks, Mitch. That didn't work on Enketo so I had to switch to
number(${q1}), which did, so I get the idea.

···
On Wednesday, March 27, 2013 3:41:30 PM UTC-5, Mitch wrote:
>
> ... or an integer (int) ( see
> http://opendatakit.org/help/form-design/binding/ )
>
> On Wed, Mar 27, 2013 at 1:40 PM, Mitch Sundt <mitche...@gmail.com wrote:
>
>> select1 fields are configured as string-valued fields.
>>
>> So to sum up the value of several of these, you need to convert the
>> string to a number:
>>
>> calculate="number(/data/q1)+number(/data/q2)"
>>
>>
>>
>> On Wed, Mar 27, 2013 at 11:44 AM, Jeff W <jmw...@gmail.com >wrote:
>>
>>> That's too bad...guess I'll just wait for Survey for that type of
>>> functionality. Any suggestions for why the sum field outside of the group
>>> isn't working?
>>>
>>> Thanks,
>>> Jeff
>>>
>>>
>>> On Wednesday, March 27, 2013 11:57:46 AM UTC-5, Gaetano Borriello wrote:
>>>
>>>> This will not work in the current ODK Collect. All evaluations are
>>>> performed when the screen is first displayed and not updated
>>>> dynamically - due to JavaRosa limitations. This will work in ODK
>>>> Survey which is based on HTML5 and is currently in alpha. Beta
>>>> release expected around mid-April.
>>>>
>>>> Gaetano
>>>>
>>>>
>>>>
>>>> On Wed, Mar 27, 2013 at 6:29 AM, Jeff W wrote:
>>>> > Hi all. I have a group of fields, all Select1 types in a table-list,
>>>> that
>>>> > represent whether an answer is correct or incorrect. I am using
>>>> XLSForm and
>>>> > have coded the values (names) of the responses as 1/0 in the choices
>>>> > worksheet. At the bottom of the group, I would like a running tally
>>>> of the
>>>> > total correct. In other words, every time a user selects 'Correct', I
>>>> would
>>>> > like the total at the bottom to update with the current total. I'm
>>>> having
>>>> > trouble getting it to work (I always get a NaN value for the total),
>>>> and I
>>>> > can't figure out which piece is causing the problem:
>>>> >
>>>> > My total field is incorrectly specified. I'm using calculate =
>>>> > "sum(${my_group})". I've also tried calculate =
>>>> "${my_field1}+${my_field2}"
>>>> > in case I didn't understand the sum syntax, but it doesn't work
>>>> either.
>>>> > Select1 types are stored as strings so it can't calculate a total.
>>>> Do I
>>>> > need to convert to integer in the constraint field for each of the
>>>> fields? I
>>>> > tried to enter the constraint for my_fieldX to ". <
>>>> int(${my_fieldX})", but
>>>> > then I get a "value not allowed" error, even though I've coded the
>>>> names as
>>>> > 0/1.
>>>> > You can't calculate a total within a group. I read another post where
>>>> it
>>>> > said you can't calculate a sum for repeating fields, but I don't know
>>>> if
>>>> > that same limitation applies to groups. Plus, I don't think this is
>>>> the
>>>> > primary problem b/c I've tested it outside the group, and it still
>>>> doesn't
>>>> > work.
>>>> >
>>>> > Thanks,
>>>> > Jeff
>>>> >
>>>> >
>>>> > --
>>>> > --
>>>> > Post: opend...@googlegroups.com
>>>> > Unsubscribe: opendatakit...@**googlegroups.com
>>>> > Options: http://groups.google.com/**group/opendatakit?hl=en
>>>> >
>>>> > ---
>>>> > 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...@**googlegroups.com.
>>>> > For more options, visit https://groups.google.com/**groups/opt_out.
>>>>
>>>> >
>>>> >
>>>>
>>> --
>>> --
>>> Post: opend...@googlegroups.com
>>> Unsubscribe: opendatakit...@googlegroups.com
>>> Options: http://groups.google.com/group/opendatakit?hl=en
>>>
>>> ---
>>> 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...@googlegroups.com .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>>
>> --
>> Mitch Sundt
>> Software Engineer
>> University of Washington
>> mitche...@gmail.com
>
>
>
>
> --
> Mitch Sundt
> Software Engineer
> University of Washington
> mitche...@gmail.com