String length formula problems

Hi there,

I am using a very simple formula to make sure that the mobile user always
inputs exactly 10 numbers as an answer:

validation condition: string-length(.) = 10

However, this formula only works sometimes… I have found that it usually
works if the 10 digit number starts with 1 but not with 2 or higher,
however if the mobile user starts the 10-digit number with 2 or higher then
the mobile user is not allowed to enter the 10th digit.

If the 10-digit number starts with 0, the mobile user is allowed to enter
10 digits however the response is considered invalid.

Could anyone help me understand this issue??

Thanks a lot,

Heidi

Hi Heidi,

What question type are you using? Integer questions only accommodate
numbers up to 2147483647 so if you are using a longer number you should use
the Phone Number/Numeric ID question instead of integer.

Jeremy

··· On Thu, Jul 9, 2015 at 2:52 AM, Heidi Lowe wrote:

Hi there,

I am using a very simple formula to make sure that the mobile user always
inputs exactly 10 numbers as an answer:

validation condition: string-length(.) = 10

However, this formula only works sometimes… I have found that it usually
works if the 10 digit number starts with 1 but not with 2 or higher,
however if the mobile user starts the 10-digit number with 2 or higher then
the mobile user is not allowed to enter the 10th digit.

If the 10-digit number starts with 0, the mobile user is allowed to enter
10 digits however the response is considered invalid.

Could anyone help me understand this issue??

Thanks a lot,

Heidi


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.


Jeremy Wacksman
Dimagi http://www.dimagi.com, Inc.

Thank you Jeremy that works,

Heidi

··· On Thursday, 9 July 2015 12:52:15 UTC+6, Heidi Lowe wrote: > > Hi there, > > I am using a very simple formula to make sure that the mobile user always > inputs exactly 10 numbers as an answer: > > validation condition: string-length(.) = 10 > > However, this formula only works sometimes... I have found that it usually > works if the 10 digit number starts with 1 but not with 2 or higher, > however if the mobile user starts the 10-digit number with 2 or higher then > the mobile user is not allowed to enter the 10th digit. > > If the 10-digit number starts with 0, the mobile user is allowed to enter > 10 digits however the response is considered invalid. > > Could anyone help me understand this issue?? > > Thanks a lot, > > Heidi >