Setting decimal significant digits

Dear community, is there a way to restrict a decimal question to a certain number of significant digits? I do not want to use the round() option because I want to alert the user to ensure no data entry errors. I would like to add a decimal question and make it require out to tenths location (o 12.3 or 1.2 or 2.3 or 100.2 but not allow 1.23 or 12). Is there a way to do this? Any information you could provide would be greatly appreciated.
Thank you!

Maybe the search function of the forum can provide help and examples, please, see Search results for 'limit decimal digits' - KoboToolbox Community Forum.


@wroos, :bowing_man: :tada:

Thank you for your help! I did a lot of searching and I guess I wasn’t searching the correct terms. I was able to use regex(.,’^(\d{0,3})(.[0-9]{0,1})?$') and it works great. Thanks again!

1 Like

@dara_glifwc, :tada:

You should use \. See Limit decimal digits in decimal question - #6 by Xiphware

Your regex would allow e.g. as entry:
. (dot only) , 0. , .0 , 1.0, Perhaps, also entry 1.00 and 1.0000 (decimal type). Please, also test things like 0a0 and a and ,1
Which type has your variable?

1 Like