Cascading Selects

Is there a maximum number of choice_labels that you can have? When I get
over 1000 it crashes ODK Collect.

Hi Andrew,
Would you mind posting the form you are using?
It will help us offer better support and it could be useful for
testing future versions of Collect.
Regards,
-Nathan

··· On Wednesday, August 8, 2012 11:17:15 AM UTC-7, Andrew Faust wrote: > > Is there a maximum number of choice_labels that you can have? When I get > over 1000 it crashes ODK Collect.

Here you go it was created using formhub.org. But when used in Collect it
crashes "force close"

WHAM9.xml (234 KB)

··· On Wednesday, August 8, 2012 1:17:15 PM UTC-5, Andrew Faust wrote: > > Is there a maximum number of choice_labels that you can have? When I get > over 1000 it crashes ODK Collect.

Hi Andrew, just to report my experiences:
774 choice_labels would crash, but on the order of 400 was fine.

The thing I thought of, but didn't have time to test; it might depend on
the number of the last non-leaf-level option list, rather than the leaf
level (as the number of questions and the length of the longest calculation
depend on this) and the number of questions in the survey. ie, for me, as I
was doing Zone > State > LGA, the determining # of choices might be for
state rather than LGA; mine were 37 States for a crashing form, and ~20 for
a non-crashing form.

just providing more data points,
--p

··· On Thursday, August 9, 2012 9:50:32 AM UTC-4, Andrew Faust wrote: > > Here you go it was created using formhub.org. But when used in Collect > it crashes "force close" > > On Wednesday, August 8, 2012 1:17:15 PM UTC-5, Andrew Faust wrote: >> >> Is there a maximum number of choice_labels that you can have? When I get >> over 1000 it crashes ODK Collect. > >

The error log shows a stack overflow error due to the very deep nesting of
your if() conditions in your calculate expressions.
It isn't an error due to the number or size of your select1s.

The size of the stack is limited in Android, and when the app tries to
write a compressed, processed, representation of the form definition to the
sdcard, the depth of your if(cond, true, if(cond2, true, ...)) nesting is
causing the write to fail (you have something like 72 nested ifs in one of
your calculations).

You will need to break the calculation into parts:



Or restructure your form to use the cascading selects feature in ODK
Collect 1.2 http://opendatakit.org/help/form-design/cascading-selects/

Again, for this form, it is not a problem with the number of select
choices, but with the depth of the if-then-else chain.

Mitch

··· On Thu, Aug 9, 2012 at 6:50 AM, Andrew Faust wrote:

Here you go it was created using formhub.org. But when used in Collect
it crashes "force close"

On Wednesday, August 8, 2012 1:17:15 PM UTC-5, Andrew Faust wrote:

Is there a maximum number of choice_labels that you can have? When I get
over 1000 it crashes ODK Collect.

--
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

Urgh. null should be ''

··· On Thu, Aug 9, 2012 at 9:29 AM, Mitch S wrote:

The error log shows a stack overflow error due to the very deep nesting of
your if() conditions in your calculate expressions.
It isn't an error due to the number or size of your select1s.

The size of the stack is limited in Android, and when the app tries to
write a compressed, processed, representation of the form definition to the
sdcard, the depth of your if(cond, true, if(cond2, true, ...)) nesting is
causing the write to fail (you have something like 72 nested ifs in one of
your calculations).

You will need to break the calculation into parts:



Or restructure your form to use the cascading selects feature in ODK
Collect 1.2 http://opendatakit.org/help/form-design/cascading-selects/

Again, for this form, it is not a problem with the number of select
choices, but with the depth of the if-then-else chain.

Mitch

On Thu, Aug 9, 2012 at 6:50 AM, Andrew Faust afaust@ncwrpc.org wrote:

Here you go it was created using formhub.org. But when used in Collect
it crashes "force close"

On Wednesday, August 8, 2012 1:17:15 PM UTC-5, Andrew Faust wrote:

Is there a maximum number of choice_labels that you can have? When I
get over 1000 it crashes ODK Collect.

--
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

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