Constraint

Hi ODK community,

I would like to add a constraint to one of the fields, to be able to enter
only one letter and up to 3 numbers, like; A1 or B30, etc..
Could you help me with that?

Thanks,
Ezzat

Hi,

Please use the code mentioned below in constraint column:

string-length(${variable})>3

Thanks,
Abbas

··· On Monday, June 20, 2016 at 3:10:47 AM UTC+5, ezzat hafez wrote: > > Hi ODK community, > > I would like to add a constraint to one of the fields, to be able to enter > only one letter and up to 3 numbers, like; A1 or B30, etc.. > Could you help me with that? > > Thanks, > Ezzat >

Hey Abbas,

I've added the script you mentioned but it didn't work, I get this error
message "There has been a problem trying to replace ${variable} with the
XPath to the survey element named 'variable'. There is no survey element
with this name."

Regards,
Ezzat

Hi, Ezzat.
Add to your field's bind (<bind ....... >), the constraint as defined below:
constraint="regex(., '[A-ZA-Z]{1}[0-9]')"; you will get finally, something
like this:
<bind ....... constraint="regex(., '[A-ZA-Z]{1}[0-9]
')">
it must work.
Regards.

··· 2016-06-20 23:29 GMT+02:00 ezzat hafez :

Hey Abbas,

I've added the script you mentioned but it didn't work, I get this error
message "There has been a problem trying to replace ${variable} with the
XPath to the survey element named 'variable'. There is no survey element
with this name."

Regards,
Ezzat

--

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.

--

Amal DAHOUNTO GLELE C.
Statisticien, Data Manager
Institut de Recherche pour le Développement (IRD)
MIVEGEC (UMR IRD 224 - CNRS 5290 - Université de Montpellier)
IRD-CREC (Cotonou, BENIN)
IRD-IRSS (Bobo, BURKINA FASO)
Tél:(+229) 97 33 83 44 ; (+226) 60 96 23 74

Hi Amal Dahounto,

How can i set only text input using constraint? no numeric input(0-9) only
text input like Capital Letter(A-Z) & Small letter(a-z)

··· On Tuesday, June 21, 2016 at 3:51:22 PM UTC+6, Amal Dahounto wrote: > > Hi, Ezzat. > Add to your field's bind (), the constraint as defined > below: > constraint="regex(., '[A-ZA-Z]{1}[0-9]*')"; you will get finally, > something like this: > > it must work. > Regards. > > 2016-06-20 23:29 GMT+02:00 ezzat hafez <ezzat...@gmail.com >: > >> Hey Abbas, >> >> I've added the script you mentioned but it didn't work, I get this error >> message "There has been a problem trying to replace ${variable} with the >> XPath to the survey element named 'variable'. There is no survey element >> with this name." >> >> Regards, >> Ezzat >> >> -- >> -- >> 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. >> > > > > -- > > > Amal DAHOUNTO GLELE C. > *Statisticien, Data Manager* > Institut de Recherche pour le Développement (IRD) > MIVEGEC (UMR IRD 224 - CNRS 5290 - Université de Montpellier) > IRD-CREC (Cotonou, BENIN) > IRD-IRSS (Bobo, BURKINA FASO) > Tél:(+229) 97 33 83 44 ; (+226) 60 96 23 74 > > > > > > > > > >

Hi, Parvez
let n be the number of letters you want to use;
A)Capital letter case
a) limited number (n) of letters
regex(., '[A-ZA-Z]{n}')
b) unlimited number of letters
regex(., '[A-ZA-Z]')
B) small letters case
a) limited
regex(., '[a-za-z]{n}')
b) unlimited
regex(., '[a-za-z]
')
Regards,

··· Le samedi 23 juillet 2016 06:47:00 UTC+2, Mostafijur Rahaman Parvez a écrit : > > Hi Amal Dahounto, > > How can i set only text input using constraint? no numeric input(0-9) only > text input like Capital Letter(A-Z) & Small letter(a-z) > > On Tuesday, June 21, 2016 at 3:51:22 PM UTC+6, Amal Dahounto wrote: >> >> Hi, Ezzat. >> Add to your field's bind (), the constraint as defined >> below: >> constraint="regex(., '[A-ZA-Z]{1}[0-9]*')"; you will get finally, >> something like this: >> >> it must work. >> Regards. >> >> 2016-06-20 23:29 GMT+02:00 ezzat hafez : >> >>> Hey Abbas, >>> >>> I've added the script you mentioned but it didn't work, I get this error >>> message "There has been a problem trying to replace ${variable} with >>> the XPath to the survey element named 'variable'. There is no survey >>> element with this name." >>> >>> Regards, >>> Ezzat >>> >>> -- >>> -- >>> 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. >>> >> >> >> >> -- >> >> >> Amal DAHOUNTO GLELE C. >> *Statisticien, Data Manager* >> Institut de Recherche pour le Développement (IRD) >> MIVEGEC (UMR IRD 224 - CNRS 5290 - Université de Montpellier) >> IRD-CREC (Cotonou, BENIN) >> IRD-IRSS (Bobo, BURKINA FASO) >> Tél:(+229) 97 33 83 44 ; (+226) 60 96 23 74 >> >> >> >> >> >> >> >> >> >>