Java type error when editing a form in ODK collect

Hi all,

One of our forms has a question which is presented to the user as a
select1, although the data that it stores is defined as in integer (I'd
like it defined in the database as numeric/integer type rather than
text/varchar as it will be used for calculations later on), so the bind
node looks like:

and for the display to user:

1 6 12 24

This validates (although maybe it shouldn't?) and will work ok in ODK
collect when an instance of the form is first created, however if I go back
to edit the form I get a java type error (Error occurred:
java.lang.Integer). I realise this should be expected as I'm mixing up the
types, but I wondered if there was a better way to handle this, so I can
store an integer value, but present it to the user as a select?

I thought about defining the bind type as string, but then manually editing
the database field to be an integer type, but this doesn't seem a great
approach.

Any suggestions/thoughts much appreciated,
Cheers,
Alex

Alex,

So I think the background of why this is the case is because when
you do a multiple select the values are concatenated so it wouldn't
make sense to concatenate integers. However, you bring up good points
for select1.

I don't really have an answer for you. You might want to post you
question on the JavaRosa mailing list as ODK uses JavaRosa to maintain
compatibility with other tools and the type information is controlled
by JavaRosa.

Cheers,
Waylon

ยทยทยท On Mon, Jun 11, 2012 at 3:03 AM, Alex Little wrote: > Hi all, > > One of our forms has a question which is presented to the user as a select1, > although the data that it stores is defined as in integer (I'd like it > defined in the database as numeric/integer type rather than text/varchar as > it will be used for calculations later on), so the bind node looks like: > > type="integer"/> > > and for the display to user: > > > > ref="jr:itext('q_interval_1hour')"/>1 > ref="jr:itext('q_interval_6hours')"/>6 > ref="jr:itext('q_interval_12hours')"/>12 > ref="jr:itext('q_interval_1day')"/>24 > > > This validates (although maybe it shouldn't?) and will work ok in ODK > collect when an instance of the form is first created, however if I go back > to edit the form I get a java type error (Error occurred: > java.lang.Integer). I realise this should be expected as I'm mixing up the > types, but I wondered if there was a better way to handle this, so I can > store an integer value, but present it to the user as a select? > > I thought about defining the bind type as string, but then manually editing > the database field to be an integer type, but this doesn't seem a great > approach. > > Any suggestions/thoughts much appreciated, > Cheers, > Alex