Constrain issuse

Dear gurus!
I intend to take the weight of newborns using my ODK form: the data type is
decimal.
How do I make to allow only numbers to 1 d.p for example(1000.9 but not
1000.91)

please I am sorry if the trend is already on? I just could not find it.
Akum

Hi Akum,

Long time, no chat :wink:

You'll have to use a regex constraint in your form. In your constraint
column in the form, put regex(., '\d+.\d{1}'). That will match one or
more numerals, a period, and one numeral. You can test this regex at
https://regex101.com.

I haven't tried this out, but because it's a decimal, you might run
into an issue where ODK is storing it as 1000.900000 or something like
that and then your regex might fail. If you find that is a problem,
use the data type text with an appearance of numbers.

Hope that helps!

Yaw

ยทยทยท On Thu, Apr 6, 2017 at 8:48 AM, Akum Aveika wrote: > Dear gurus! > I intend to take the weight of newborns using my ODK form: the data type is > decimal. > How do I make to allow only numbers to 1 d.p for example(1000.9 but not > 1000.91) > > please I am sorry if the trend is already on? I just could not find it. > Akum > > -- > -- > 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.