Phone number and string length

Hi Samantha,

This might be a limitation of Enketo. Have you tried it in ODK Collect?

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Fri, Jul 31, 2015 at 9:15 AM, samantha.roubideaux@rst-nsn.gov wrote:

constraint="string-length(.)=10" ........ this didn't work for me
so I entered "string-length(.)=10"...... this didn't limit it too 10 but
gave me the option to enter 16 digits...

Using xlsx and using enketo to preview.

On Monday, June 29, 2015 at 2:39:54 PM UTC-5, Mitch Sundt wrote:

When using the string type with "numbers" appearance:

constraint="string-length(.)=10"

https://opendatakit.org/help/form-design/binding/

On Fri, Jun 19, 2015 at 5:57 AM, Ayoub Kakande akak...@gmail.com wrote:

Hello,
I have been back and forth on this forum on how to input phone numbers
i have seen that i can mimic the keyboard to display numbers on string
type

  1. however my qtn still remains is there a way of limiting the maximum
    numbers to be 10 digits and not 9 digits so as for enumerators to input
    phone numbers
  2. How do i limit string length so 11 characters

--

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


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

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

--

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


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

Hello Yaw,

I can enter up to 16 numbers on enketo but on my samsung s5, I can only
enter 9 digits.

··· On Friday, July 31, 2015 at 10:55:02 AM UTC-5, Yaw Anokwa wrote: > > Hi Samantha, > > This might be a limitation of Enketo. Have you tried it in ODK Collect? > > Yaw > -- > Need ODK services? http://nafundi.com provides form design, server > setup, professional support, and software development for ODK. > > On Fri, Jul 31, 2015 at 9:15 AM, <samantha....@rst-nsn.gov > wrote: > > constraint="string-length(.)=10" ........ this didn't work for me > > so I entered "string-length(.)=10"...... this didn't limit it too 10 but > > gave me the option to enter 16 digits... > > > > Using xlsx and using enketo to preview. > > > > > > > > On Monday, June 29, 2015 at 2:39:54 PM UTC-5, Mitch Sundt wrote: > >> > >> When using the string type with "numbers" appearance: > >> > >> constraint="string-length(.)=10" > >> > >> https://opendatakit.org/help/form-design/binding/ > >> > >> > >> On Fri, Jun 19, 2015 at 5:57 AM, Ayoub Kakande wrote: > >>> > >>> Hello, > >>> I have been back and forth on this forum on how to input phone numbers > >>> i have seen that i can mimic the keyboard to display numbers on string > >>> type > >>> 1) however my qtn still remains is there a way of limiting the maximum > >>> numbers to be 10 digits and not 9 digits so as for enumerators to > input > >>> phone numbers > >>> 2) How do i limit string length so 11 characters > >>> > >>> -- > >>> -- > >>> Post: opend...@googlegroups.com > >>> Unsubscribe: opendatakit...@googlegroups.com > >>> Options: http://groups.google.com/group/opendatakit?hl=en > >>> > >>> --- > >>> You received this message because you are subscribed to the Google > Groups > >>> "ODK Community" group. > >>> To unsubscribe from this group and stop receiving emails from it, send > an > >>> email to opendatakit...@googlegroups.com. > >>> For more options, visit https://groups.google.com/d/optout. > >> > >> > >> > >> > >> -- > >> Mitch Sundt > >> Software Engineer > >> University of Washington > >> mitche...@gmail.com > > > > -- > > -- > > Post: opend...@googlegroups.com > > Unsubscribe: opendatakit...@googlegroups.com > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > --- > > You received this message because you are subscribed to the Google > Groups > > "ODK Community" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to opendatakit...@googlegroups.com . > > For more options, visit https://groups.google.com/d/optout. >

Make sure you are using the text data type with appearance of numbers.

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Fri, Jul 31, 2015 at 4:20 PM, samantha.roubideaux@rst-nsn.gov wrote:

Hello Yaw,

I can enter up to 16 numbers on enketo but on my samsung s5, I can only
enter 9 digits.

On Friday, July 31, 2015 at 10:55:02 AM UTC-5, Yaw Anokwa wrote:

Hi Samantha,

This might be a limitation of Enketo. Have you tried it in ODK Collect?

Yaw

Need ODK services? http://nafundi.com provides form design, server
setup, professional support, and software development for ODK.

On Fri, Jul 31, 2015 at 9:15 AM, samantha....@rst-nsn.gov wrote:

constraint="string-length(.)=10" ........ this didn't work for me
so I entered "string-length(.)=10"...... this didn't limit it too 10 but
gave me the option to enter 16 digits...

Using xlsx and using enketo to preview.

On Monday, June 29, 2015 at 2:39:54 PM UTC-5, Mitch Sundt wrote:

When using the string type with "numbers" appearance:

constraint="string-length(.)=10"

https://opendatakit.org/help/form-design/binding/

On Fri, Jun 19, 2015 at 5:57 AM, Ayoub Kakande akak...@gmail.com wrote:

Hello,
I have been back and forth on this forum on how to input phone numbers
i have seen that i can mimic the keyboard to display numbers on string
type

  1. however my qtn still remains is there a way of limiting the maximum
    numbers to be 10 digits and not 9 digits so as for enumerators to
    input
    phone numbers
  2. How do i limit string length so 11 characters

--

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


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

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

--

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


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

Thank you, I will try this.

··· On Friday, July 31, 2015 at 4:22:53 PM UTC-5, Yaw Anokwa wrote: > > Make sure you are using the text data type with appearance of numbers. > > Yaw > -- > Need ODK services? http://nafundi.com provides form design, server > setup, professional support, and software development for ODK. > > On Fri, Jul 31, 2015 at 4:20 PM, <samantha....@rst-nsn.gov > wrote: > > Hello Yaw, > > > > I can enter up to 16 numbers on enketo but on my samsung s5, I can only > > enter 9 digits. > > > > On Friday, July 31, 2015 at 10:55:02 AM UTC-5, Yaw Anokwa wrote: > >> > >> Hi Samantha, > >> > >> This might be a limitation of Enketo. Have you tried it in ODK Collect? > >> > >> Yaw > >> -- > >> Need ODK services? http://nafundi.com provides form design, server > >> setup, professional support, and software development for ODK. > >> > >> On Fri, Jul 31, 2015 at 9:15 AM, wrote: > >> > constraint="string-length(.)=10" ........ this didn't work for me > >> > so I entered "string-length(.)=10"...... this didn't limit it too 10 > but > >> > gave me the option to enter 16 digits... > >> > > >> > Using xlsx and using enketo to preview. > >> > > >> > > >> > > >> > On Monday, June 29, 2015 at 2:39:54 PM UTC-5, Mitch Sundt wrote: > >> >> > >> >> When using the string type with "numbers" appearance: > >> >> > >> >> constraint="string-length(.)=10" > >> >> > >> >> https://opendatakit.org/help/form-design/binding/ > >> >> > >> >> > >> >> On Fri, Jun 19, 2015 at 5:57 AM, Ayoub Kakande wrote: > >> >>> > >> >>> Hello, > >> >>> I have been back and forth on this forum on how to input phone > numbers > >> >>> i have seen that i can mimic the keyboard to display numbers on > string > >> >>> type > >> >>> 1) however my qtn still remains is there a way of limiting the > maximum > >> >>> numbers to be 10 digits and not 9 digits so as for enumerators to > >> >>> input > >> >>> phone numbers > >> >>> 2) How do i limit string length so 11 characters > >> >>> > >> >>> -- > >> >>> -- > >> >>> Post: opend...@googlegroups.com > >> >>> Unsubscribe: opendatakit...@googlegroups.com > >> >>> Options: http://groups.google.com/group/opendatakit?hl=en > >> >>> > >> >>> --- > >> >>> You received this message because you are subscribed to the Google > >> >>> Groups > >> >>> "ODK Community" group. > >> >>> To unsubscribe from this group and stop receiving emails from it, > send > >> >>> an > >> >>> email to opendatakit...@googlegroups.com. > >> >>> For more options, visit https://groups.google.com/d/optout. > >> >> > >> >> > >> >> > >> >> > >> >> -- > >> >> Mitch Sundt > >> >> Software Engineer > >> >> University of Washington > >> >> mitche...@gmail.com > >> > > >> > -- > >> > -- > >> > Post: opend...@googlegroups.com > >> > Unsubscribe: opendatakit...@googlegroups.com > >> > Options: http://groups.google.com/group/opendatakit?hl=en > >> > > >> > --- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "ODK Community" group. > >> > To unsubscribe from this group and stop receiving emails from it, > send > >> > an > >> > email to opendatakit...@googlegroups.com. > >> > For more options, visit https://groups.google.com/d/optout. >

Hello everyone,

Sorry for opening this old thread, but it is related to the topic.

When using string-length(.)=8 and trying to convert the Excel File to XLS, this error is issued:

bind for ${report_num} contains invalid constraint expression [substr( ${report_num} , 1, 6) = ${cahw_id} AND substr( ${report_num} , 0,1) = number(5) AND string-length(.)=8] Couldn't understand the expression starting at this point: ...ntry5/cahw_id\xcd\x8eAND substr( /T2...\n\nResult: Invalid"

Am I missing something? The form works perfectly without string-length(.)=8

Hi, we have 10 digit phone numbers, starting with 0. I use constraint=regex(.,'[0-9]{10}') and appearance = numbers. This appears to work for me.

Hello @Brian_Shelton,

Thanks for your input. I have tried to use your code and also including ^ and $ on both ends. None of them work, still XLSForm Online do not convert the excel file to XForms files.

I am starting to think it is a problem of the conversor than the form itself. (EDIT: I also used the ODK XLSForm Offline app and the same error is issued)

Hope any other reader knows where the problem is.

Hi Francisco,

Sorry to read that it did not work.

Here is an extract from my form. I must put in 10 digits, or 13 digits for a person’s identity number. An error message displays if exactly 10 or 13 digits, respectively, are not captured.

The first and last row are personal identity numbers, not phone numbers but same principle. My device is a Samsung Galaxy Pro tablet.

type

name

label

hint

required

relevant

constraint

constraint_message

appearance

text

Cellnumber

Q11 Cell phone number?

Only if YES selected for previous question

${Purpose} = 'Business_premises'

regex(.,'[0-9]{10}')

Must be 10 digits

numbers

text

IdentityNo

Q39 What is the ID number of the household head?

regex(.,'[0-9]{13}')

numbers

text

ContactNoHH

Q45 What is the household heads contact number?

Only numbers and no spaces

regex(.,'[0-9]{10}')

Must be 10 digits

numbers

text

contactNoOther

Q46 What is the contact number of another household member (i. e. spouse)?

regex(.,'[0-9]{10}')

Must be 10 digits

numbers

text

Partners_IDNo

Q73 What is your partner's ID number?

regex(.,'[0-9]{13}')

numbers

Constraint

regex(.,'[0-9]{10}')

I hope this helps,

Regards,

Brian

Hello @Brian_Shelton,

Thanks for the example and efforts. I do not think my constraint field is wrong. Unless it does not allow three different constraints on the same field or some of them are mutually exclusive.

My best guess is that it is a problem of the convertion to XLSForm. I hope someone else can shed more light on the issue.

Hi Francisco,

Sorry that you are still having a problem. I also use XLSForm Online. Good luck.

image

SOLUTION:

Does not work:

substr( ${hh_id} , 1, 6) = ${id} AND substr(${report_num} , 0,1) = number(5) AND regex(.,'[0-9]{8}')

Does work:

regex(.,'[0-9]{8}') AND substr( ${hh_id} , 1, 6) = ${id} AND substr(${report_num} , 0,1) = number(5)

Apparently, regex needs to appear first in the constrain field.

Hi Brian,

Thanks for your help. This seems not to limit the number of digits to 10! Any other suggestions?

There's likely a mistake in your form. If you can share the form, I'm sure someone would be able to help.

I tried this approach and it worked perfectly

constraint = regex(.,'^[0-9]{10}$')

I am using appearance="number" and constraint="(regex(.,'[0-9]{11}'))" but alphanumeric
keyboard appears rather than the numeric one.
Attached is screenshot of code.

Could you attach your form for testing not only the screenshot?
What ODK Collect version and what device do you use?

Thanks Grzesiek2010,

I am using ODK Build v0.3.5 for form designing.
ODK Collect version is 1.24.1 (Latest).
Using on Chinese NFC tablet and Huawei Honor 6X .

Here is code i am using.
phone.xml (915 Bytes)

Very grateful to you.
Regards,

You put appearance in a wrong place, here is the fixed version: phone.xml (913 Bytes)

Btw. building forms by editing xml files is not the best way and causes bug like this one, I would recommend using xls

Thanks Grzesiek2010,

I am very grateful to you.

A post was split to a new topic: Restrict length of batch number