Error: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String

What could this error message mean?

Sam,

Something is trying to change a decimal number into a text string. Perhaps
you have a decimal-type field with some kind of constraint or relevance
expression that is treating it as text? You'll need to supply the context
and debug accordingly, I'm afraid.

Best,

Chris

··· On Thu, Jan 24, 2013 at 4:56 PM, Sam wrote:

What could this error message mean?

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

Hi Chris,

Thanks for your response. I'm attaching a short form that I'm using if you
have a chance to take a look and point me in the right direction.

There are 2 "decimal" type questions here on lines 65 and 70. But even when
I turned these into integers, I still get the same error.

Many thanks,
Sam

test_Nerica.xls (59.5 KB)

··· On Thursday, January 24, 2013, Christopher Robert wrote:

Sam,

Something is trying to change a decimal number into a text string. Perhaps
you have a decimal-type field with some kind of constraint or relevance
expression that is treating it as text? You'll need to supply the context
and debug accordingly, I'm afraid.

Best,

Chris

On Thu, Jan 24, 2013 at 4:56 PM, Sam <samantha.elghanayan@gmail.com<javascript:_e({}, 'cvml', 'samantha.elghanayan@gmail.com');> wrote:

What could this error message mean?

--

Post: opendatakit@googlegroups.com <javascript:_e({}, 'cvml',
'opendatakit@googlegroups.com');>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>
Options: http://groups.google.com/group/opendatakit?hl=en

--

Post: opendatakit@googlegroups.com <javascript:_e({}, 'cvml',
'opendatakit@googlegroups.com');>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>
Options: http://groups.google.com/group/opendatakit?hl=en

--

Samantha Elghanayan
Project Associate, Innovations for Poverty Action
+232 (0) 78 203075
+232 (0) 88 752221

Hi Sam,

You might need to remove fields group-by-group to narrow it down. Glancing
at your form, I only noticed that "preparation_type" was missing in the
latter rows of your choices sheet. Maybe somebody else will have another
idea. (You might report, though, the exact circumstances under which this
error appears. That would give them a much better shot at being helpful.)

Best,

Chris

··· On Thu, Jan 24, 2013 at 5:24 PM, Samantha Elghanayan < samantha.elghanayan@gmail.com> wrote:

Hi Chris,

Thanks for your response. I'm attaching a short form that I'm using if you
have a chance to take a look and point me in the right direction.

There are 2 "decimal" type questions here on lines 65 and 70. But even
when I turned these into integers, I still get the same error.

Many thanks,
Sam
On Thursday, January 24, 2013, Christopher Robert wrote:

Sam,

Something is trying to change a decimal number into a text string.
Perhaps you have a decimal-type field with some kind of constraint or
relevance expression that is treating it as text? You'll need to supply the
context and debug accordingly, I'm afraid.

Best,

Chris

On Thu, Jan 24, 2013 at 4:56 PM, Sam samantha.elghanayan@gmail.comwrote:

What could this error message mean?

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Samantha Elghanayan
Project Associate, Innovations for Poverty Action
+232 (0) 78 203075
+232 (0) 88 752221

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

In formulas, you need to be careful if a field type is double to convert it
explicitly to a string when used in a string expression.

To convert from double to string, use

string(/path/to/doubleField)

See the javarosa type conversion functions here:

Note that selected(,) expects string values, so if you were testing a
number against a string, that would be a problem.
You would use selected(/path/to/field, '1') and not:
selected(/path/to/field, 1)

Mitch

··· On Thu, Jan 24, 2013 at 7:36 AM, Samantha Elghanayan < samantha.elghanayan@gmail.com> wrote:

Hi Chris,

Thank you. I will try to narrow it down.

Thanks for your help!

Sam

Samantha Elghanayan
Project Associate, Innovations for Poverty Action
+232 (0) 78 203075
+232 (0) 88 752221

On Thu, Jan 24, 2013 at 3:32 PM, Christopher Robert < chris_robert@hksphd.harvard.edu> wrote:

Hi Sam,

You might need to remove fields group-by-group to narrow it down.
Glancing at your form, I only noticed that "preparation_type" was missing
in the latter rows of your choices sheet. Maybe somebody else will have
another idea. (You might report, though, the exact circumstances under
which this error appears. That would give them a much better shot at being
helpful.)

Best,

Chris

On Thu, Jan 24, 2013 at 5:24 PM, Samantha Elghanayan < samantha.elghanayan@gmail.com> wrote:

Hi Chris,

Thanks for your response. I'm attaching a short form that I'm using if
you have a chance to take a look and point me in the right direction.

There are 2 "decimal" type questions here on lines 65 and 70. But even
when I turned these into integers, I still get the same error.

Many thanks,
Sam
On Thursday, January 24, 2013, Christopher Robert wrote:

Sam,

Something is trying to change a decimal number into a text string.
Perhaps you have a decimal-type field with some kind of constraint or
relevance expression that is treating it as text? You'll need to supply the
context and debug accordingly, I'm afraid.

Best,

Chris

On Thu, Jan 24, 2013 at 4:56 PM, Sam samantha.elghanayan@gmail.comwrote:

What could this error message mean?

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Samantha Elghanayan
Project Associate, Innovations for Poverty Action
+232 (0) 78 203075
+232 (0) 88 752221

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Hi Chris,

Thank you. I will try to narrow it down.

Thanks for your help!

Sam

Samantha Elghanayan
Project Associate, Innovations for Poverty Action
+232 (0) 78 203075
+232 (0) 88 752221

··· On Thu, Jan 24, 2013 at 3:32 PM, Christopher Robert < chris_robert@hksphd.harvard.edu> wrote:

Hi Sam,

You might need to remove fields group-by-group to narrow it down. Glancing
at your form, I only noticed that "preparation_type" was missing in the
latter rows of your choices sheet. Maybe somebody else will have another
idea. (You might report, though, the exact circumstances under which this
error appears. That would give them a much better shot at being helpful.)

Best,

Chris

On Thu, Jan 24, 2013 at 5:24 PM, Samantha Elghanayan < samantha.elghanayan@gmail.com> wrote:

Hi Chris,

Thanks for your response. I'm attaching a short form that I'm using if
you have a chance to take a look and point me in the right direction.

There are 2 "decimal" type questions here on lines 65 and 70. But even
when I turned these into integers, I still get the same error.

Many thanks,
Sam
On Thursday, January 24, 2013, Christopher Robert wrote:

Sam,

Something is trying to change a decimal number into a text string.
Perhaps you have a decimal-type field with some kind of constraint or
relevance expression that is treating it as text? You'll need to supply the
context and debug accordingly, I'm afraid.

Best,

Chris

On Thu, Jan 24, 2013 at 4:56 PM, Sam samantha.elghanayan@gmail.comwrote:

What could this error message mean?

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Samantha Elghanayan
Project Associate, Innovations for Poverty Action
+232 (0) 78 203075
+232 (0) 88 752221

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

Thanks to everyone for their help. The problem has been solved.
Sam

··· On Thursday, January 24, 2013, Mitch S wrote:

In formulas, you need to be careful if a field type is double to convert
it explicitly to a string when used in a string expression.

To convert from double to string, use

string(/path/to/doubleField)

See the javarosa type conversion functions here:
http://opendatakit.org/help/form-design/binding/

Note that selected(,) expects string values, so if you were testing a
number against a string, that would be a problem.
You would use selected(/path/to/field, '1') and not:
selected(/path/to/field, 1)

Mitch

On Thu, Jan 24, 2013 at 7:36 AM, Samantha Elghanayan < samantha.elghanayan@gmail.com> wrote:

Hi Chris,

Thank you. I will try to narrow it down.

Thanks for your help!

Sam

Samantha Elghanayan
Project Associate, Innovations for Poverty Action
+232 (0) 78 203075
+232 (0) 88 752221

On Thu, Jan 24, 2013 at 3:32 PM, Christopher Robert < chris_robert@hksphd.harvard.edu> wrote:

Hi Sam,

You might need to remove fields group-by-group to narrow it down. Glancing
at your form, I only noticed that "preparation_type" was missing in the
latter rows of your choices sheet. Maybe somebody else will have another
idea. (You might report, though, the exact circumstances under which this
error appears. That would give them a much better shot at being helpful.)

Best,

Chris

On Thu, Jan 24, 2013 at 5:24 PM, Samantha Elghanayan < samantha.elghanayan@gmail.com> wrote:

Hi Chris,

Thanks for your response. I'm attaching a short form that I'm using if you
have a chance to take a look and point me in the right direction.

There are 2 "decimal" type questions here on lines 65 and 70. But even
when I turned these into integers, I still get the same error.

Many thanks,
Sam
On Thursday, January 24, 2013, Christopher Robert wrote:

Sam,

Something is trying to change a decimal number into a text string. Perhaps
you have a decimal-type field with some kind of constraint or relevance
expression that is treating it as text? You'll need to supply the context
and debug accordingly, I'm afraid.

Best,

Chris

On Thu, Jan 24, 2013 at 4:56 PM, Sam samantha.elghanayan@gmail.comwrote:

What could this error message mean?

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--

Samantha Elghanayan
Project Associate, Innovations for Poverty Action
+232 (0) 78 203075
+232 (0) 88 752221

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups. http://groups.google.com/group/opendatakit?hl=en

Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com <javascript:_e({}, 'cvml',
'mitchellsundt@gmail.com');>

--

Post: opendatakit@googlegroups.com <javascript:_e({}, 'cvml',
'opendatakit@googlegroups.com');>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>
Options: http://groups.google.com/group/opendatakit?hl=en

--

Samantha Elghanayan
Project Associate, Innovations for Poverty Action
+232 (0) 78 203075
+232 (0) 88 752221