Easy question: What is the maximum length of a string field

Hi folks -- I am thinking of making a text field that will grow in length
(through concatenation) each time a form is re-visited. Of course I want to
guard against the thing becoming too giant and causing an error. What is
the maximum length that a text field can reach, for instance through
concatenation commands, before causing an error?

Thanks!
Eric

Eric,

I'm not actually sure this is an "easy" question!

The technically correct answer is that the maximum length a string can
return would be 2^31-1 characters - the size of a java integer. I can't
think of any technical reason the code base shouldn't be able to handle a
string up to his size.

You're more likely to run into an issue with the amount of heap allocated
by your device - generally 16MB for Android, which would still give you on
the order of millions of characters.

The "easy" answer is that you're very unlikely to run into an issue with
String length during normal usage since Java has been pretty thoroughly
optimized for things like this.

My disclaimer here is that its possible that somewhere in the CommCare
engine there's a bottleneck I'm not aware of that'll choke up the app
before this. However, I've never seen this come up before and would be glad
to look into it if you discovered such a choke point. Hopefully if people
have anecdotal experience with such a limitation they'll chime in here.

Best,
Will

··· On Fri, Oct 24, 2014 at 3:19 AM, Eric Stephan wrote:

Hi folks -- I am thinking of making a text field that will grow in length
(through concatenation) each time a form is re-visited. Of course I want to
guard against the thing becoming too giant and causing an error. What is
the maximum length that a text field can reach, for instance through
concatenation commands, before causing an error?

Thanks!
Eric

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wow, thanks. I guess this means I will have to tell my users not to visit
certain forms 4 million times... hopefully they won't complain too much
about that.

Thanks much for your info! I'll keep an eye open for any "log string"
hiccups, but let me know if you see any also.

Eric

··· On Saturday, October 25, 2014 12:23:14 AM UTC+7, William Pride wrote: > > Eric, > > I'm not actually sure this is an "easy" question! > > The technically correct answer is that the maximum length a string can > return would be 2^31-1 characters - the size of a java integer. I can't > think of any technical reason the code base shouldn't be able to handle a > string up to his size. > > You're more likely to run into an issue with the amount of heap allocated > by your device - generally 16MB for Android, which would still give you on > the order of millions of characters. > > The "easy" answer is that you're very unlikely to run into an issue with > String length during normal usage since Java has been pretty thoroughly > optimized for things like this. > > My disclaimer here is that its possible that somewhere in the CommCare > engine there's a bottleneck I'm not aware of that'll choke up the app > before this. However, I've never seen this come up before and would be glad > to look into it if you discovered such a choke point. Hopefully if people > have anecdotal experience with such a limitation they'll chime in here. > > Best, > Will > > On Fri, Oct 24, 2014 at 3:19 AM, Eric Stephan <este...@fhi360.org > wrote: > >> >> Hi folks -- I am thinking of making a text field that will grow in length >> (through concatenation) each time a form is re-visited. Of course I want to >> guard against the thing becoming too giant and causing an error. What is >> the maximum length that a text field can reach, for instance through >> concatenation commands, before causing an error? >> >> Thanks! >> Eric >> >> -- >> You received this message because you are subscribed to the Google Groups >> "commcare-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to commcare-user...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

Hey Eric,

While I think it's true that this may be the primary limitation - I would
recommend thoroughly testing your workflow at whatever size sting you
expect to end up in there, and do it end-to-end in both the mobile and HQ.
It's possible that you may encounter issues somewhere else in the stack, as
well as potential performance issues that could come up.

thanks,
Cory

··· On Mon, Oct 27, 2014 at 12:29 AM, Eric Stephan wrote:

Wow, thanks. I guess this means I will have to tell my users not to visit
certain forms 4 million times... hopefully they won't complain too much
about that.

Thanks much for your info! I'll keep an eye open for any "log string"
hiccups, but let me know if you see any also.

Eric

On Saturday, October 25, 2014 12:23:14 AM UTC+7, William Pride wrote:

Eric,

I'm not actually sure this is an "easy" question!

The technically correct answer is that the maximum length a string can
return would be 2^31-1 characters - the size of a java integer. I can't
think of any technical reason the code base shouldn't be able to handle a
string up to his size.

You're more likely to run into an issue with the amount of heap allocated
by your device - generally 16MB for Android, which would still give you on
the order of millions of characters.

The "easy" answer is that you're very unlikely to run into an issue with
String length during normal usage since Java has been pretty thoroughly
optimized for things like this.

My disclaimer here is that its possible that somewhere in the CommCare
engine there's a bottleneck I'm not aware of that'll choke up the app
before this. However, I've never seen this come up before and would be glad
to look into it if you discovered such a choke point. Hopefully if people
have anecdotal experience with such a limitation they'll chime in here.

Best,
Will

On Fri, Oct 24, 2014 at 3:19 AM, Eric Stephan este...@fhi360.org wrote:

Hi folks -- I am thinking of making a text field that will grow in
length (through concatenation) each time a form is re-visited. Of course I
want to guard against the thing becoming too giant and causing an error.
What is the maximum length that a text field can reach, for instance
through concatenation commands, before causing an error?

Thanks!
Eric

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.